RAVE
Lib.rave_pgf.RavePGF Class Reference

The product generation framework class containing the product generation functionality. More...

Public Member Functions

 __init__ (self)
 Constructor.
 
 Help (self, name=None)
 Built-in algorithm query.
 
 register (self, name, module, function, Help="", strings="", ints="", floats="", seqs="")
 Registers a new item in the registry.
 
 update_registry (self)
 Re-loads the generation registry, assuming it's been modified on file.
 
 deregister (self, name)
 De-registers a new item in one of the registries.
 
 flush (self, stupid_password)
 Public method for dumping queue to file.
 
 generate (self, algorithm, files, arguments)
 Dispatcher method.
 
 get_quality_controls (self)
 Returns the registered controls.
 
 get_areas (self)
 Returns the areas available to the composite generator.
 
 get_pcs_definitions (self)
 Return the pcs definitions.
 
 job_done (self, jobid)
 
 execute (self, command)
 Executes a shell escape command.
 
 echo_args (self, arguments)
 Pretty useless method used to check argument types.
 

Public Attributes

 name = multiprocessing.current_process().name
 
 logger = rave_pgf_logger.create_logger()
 
 runner = None
 
 queue = None
 
 pool = None
 
 job_done
 

Protected Member Functions

 _listMethods (self)
 This method must exist for system.listMethods to work.
 
 _methodHelp (self, method)
 This method must exist for system.listMethods to work.
 
 _queue_job (self, algorithm, files, arguments, jobid)
 Queue a job for processing.
 
 _dump_queue (self, filename=rave_pgf_qtools.QFILE)
 Dumps the job queue to XML file.
 
 _load_queue (self)
 Loads the job queue from XML file.
 
 _run_all_jobs (self)
 Internal executor of the product generation algorithm queue, according to how they are queued.
 
 _run (self, algorithm, files, arguments)
 Internal direct executor of the product generation algorithms.
 
 _generate (self, algorithm, files, arguments)
 The mother method that coordinates the product generation calls.
 

Protected Attributes

 _pid = os.getpid()
 
int _job_counter = 0
 
str _jobid = "%i-0" % self._pid
 
 _algorithm_registry = None
 
 _client = None
 

Detailed Description

The product generation framework class containing the product generation functionality.

Constructor & Destructor Documentation

◆ __init__()

Lib.rave_pgf.RavePGF.__init__ ( self)

Constructor.

Member Function Documentation

◆ _dump_queue()

Lib.rave_pgf.RavePGF._dump_queue ( self,
filename = rave_pgf_qtools.QFILE )
protected

Dumps the job queue to XML file.

Called automatically when the server is stopped.

Parameters
filenamestring file name to white to dump the queue

◆ _generate()

Lib.rave_pgf.RavePGF._generate ( self,
algorithm,
files,
arguments )
protected

The mother method that coordinates the product generation calls.

This method verifies the integrity of the arguments, then runs the job. If the result gets injected to the DEX, then this is also done.

Parameters
algorithmstring to the desired product generation call
fileslist of file strings
argumentslist of strings, ordered as 'key-value' pairs, so that even items are argument names and odd ones are their values. These must be parsed into their corrects formats, ie. int, float, list, etc.
Returns
string either "OK" or an error with a corresponding Traceback

◆ _listMethods()

Lib.rave_pgf.RavePGF._listMethods ( self)
protected

This method must exist for system.listMethods to work.

◆ _load_queue()

Lib.rave_pgf.RavePGF._load_queue ( self)
protected

Loads the job queue from XML file.

Called automatically when the server is started, even if the queue is empty.

◆ _methodHelp()

Lib.rave_pgf.RavePGF._methodHelp ( self,
method )
protected

This method must exist for system.listMethods to work.

Parameters
methodstring name of method for which to get help.

◆ _queue_job()

Lib.rave_pgf.RavePGF._queue_job ( self,
algorithm,
files,
arguments,
jobid )
protected

Queue a job for processing.

All jobs are calls to the generate method.

Parameters
algorithm,anElement object that contains all the information required to run a job.
files,alist of input file strings.
arguments,alist of argument key-value pairs.
jobidstring unique ID of that job.

◆ _run()

Lib.rave_pgf.RavePGF._run ( self,
algorithm,
files,
arguments )
protected

Internal direct executor of the product generation algorithms.

This will automatically verify the module and reload it if it has been modified. The module is loaded, and the function specified is executed with the files and arguments lists. The function must not return anything.

Parameters
algorithmElement copied from self._algorithm_registry
fileslist of file strings
argumentslist of verified arguments to pass to the generator
Returns
the result from the algorithm, either filename or None

◆ _run_all_jobs()

Lib.rave_pgf.RavePGF._run_all_jobs ( self)
protected

Internal executor of the product generation algorithm queue, according to how they are queued.

Runs only once at startup, if there are dumped jobs in the queue.

◆ deregister()

Lib.rave_pgf.RavePGF.deregister ( self,
name )

De-registers a new item in one of the registries.

Parameters
namestring name of the registry entry to de-register.
Returns
string

◆ echo_args()

Lib.rave_pgf.RavePGF.echo_args ( self,
arguments )

Pretty useless method used to check argument types.

Parameters
argumentssequence of ints, floats, strings in arbitrary order.
Returns
string of arguments

◆ execute()

Lib.rave_pgf.RavePGF.execute ( self,
command )

Executes a shell escape command.

Parameters
commandthe shell command without &
Returns
: OK

◆ flush()

Lib.rave_pgf.RavePGF.flush ( self,
stupid_password )

Public method for dumping queue to file.

Parameters
stupid_passwordA rudimentary safeguard against sabotage.
Returns
string

◆ generate()

Lib.rave_pgf.RavePGF.generate ( self,
algorithm,
files,
arguments )

Dispatcher method.

Calls the generate function that in turn creates a provisional instance of a PGF object to invoke the _generate method that does the job. The algorithm's presence in the registry is checked first.

Parameters
algorithmstring to the desired product generation call
fileslist of file strings
argumentslist of strings, ordered as 'key-value' pairs, so that even items are argument names and odd ones are their values. These must be parsed into their corrects formats, ie. int, float, list, etc.
Returns
string "OK" always, which is ignored because the real work is deferred.

◆ get_areas()

Lib.rave_pgf.RavePGF.get_areas ( self)

Returns the areas available to the composite generator.

◆ get_pcs_definitions()

Lib.rave_pgf.RavePGF.get_pcs_definitions ( self)

Return the pcs definitions.

◆ get_quality_controls()

Lib.rave_pgf.RavePGF.get_quality_controls ( self)

Returns the registered controls.

◆ Help()

Lib.rave_pgf.RavePGF.Help ( self,
name = None )

Built-in algorithm query.

Parameters
namestring, optionally the name of the algorithm being queried.
Returns
string a help text comprising the names of each registered algorithm and its descriptive text.

◆ register()

Lib.rave_pgf.RavePGF.register ( self,
name,
module,
function,
Help = "",
strings = "",
ints = "",
floats = "",
seqs = "" )

Registers a new item in the registry.

Re-registering an item is done in the same way.

Parameters
namestring algorithm's name.
modulestring name of the module to import.
functionstring name of the function to run in the module.
Helpstring containing explanatory text for this registry entry.
stringsstring of comma-separated argument names that are strings.
intsstring of comma-separated argument names that are integers.
floatsstring of comma-separated argument names that are floats.
seqsstring of comma-separated argument names that are sequences.
Returns
string

◆ update_registry()

Lib.rave_pgf.RavePGF.update_registry ( self)

Re-loads the generation registry, assuming it's been modified on file.

Is this ever needed or used?


The documentation for this class was generated from the following file: