Package park :: Package core :: Module datastore :: Class FetchService

Class FetchService

source code


Instance Methods
 
prepare(self, request)
Prepare to run the job.
source code
 
run(self)
Run the job.
source code
 
progress(self)
Returns the tuple (k,n,'units') where progress is k cycles of work complete out of a possible n cycles of total work.
source code

Inherited from service.Service: __str__, checkpoint, cleanup, restore

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Class Methods

Inherited from service.Service: check_version

Class Variables
  service = 'park.services.fetch'
Name of the service
  version = '1.0'
Version number of the service
Properties

Inherited from object: __class__

Method Details

prepare(self, request)

source code 
Prepare to run the job. All the required resources specified in preconditions should already be in place. This method is called once the job is ready to run. The specified work is the request to be performed.
Overrides: service.Service.prepare
(inherited documentation)

run(self)

source code 

Run the job.  When the job is complete result will be set to
the results of the run.

This must be implemented in the subclass.

The run job should look something like the following:

    best = 0
    for c in cycles:
        handler.ready()
        results = handler.map(self.task, c.tasklist)
        best =
        if result > best:
            best = result
            handler.improved(best)
    return best

The handler.ready() call will raise a park.core.service.AbortService
exception if the controller sends an abort message.  The run
function need not do anything in response, except possibly signal
handler.improved(value)

Overrides: service.Service.run
(inherited documentation)

progress(self)

source code 

Returns the tuple (k,n,'units') where progress is k cycles of work complete out of a possible n cycles of total work.

Return None if progress is unknown.

Overrides: service.Service.progress
(inherited documentation)