batch_job

Most applications need to perform some scheduled jobs to process information. Users need to be able to monitor the functioning of those scheduled jobs.

These classes provide the means to store the result of batch jobs to enable the user to review or plan them.

class camelot.model.batch_job.BatchJob(*args, **kwargs)[source]
A batch job is a long running task that is scheduled by
the user or started periodically. The BatchJob objects can be used to store information on such running task so the end user can review them
../../_images/new_view_batchjob.png

Fields :

  • host : VARCHAR(256), required
  • message : TEXT, not required
  • type : refers to BatchJobType
add_exception_to_message(exc_type=None, exc_val=None, exc_tb=None)[source]

If an exception occurs in a batch job, this method can be used to add the stack trace of an exception to the message.

If no arguments are given, sys.exc_traceback is used.

Parameters:
  • exc_type – type of the exception, such as in sys.exc_type
  • exc_val – value of the exception, such as in sys.exc_value
  • exc_tb – a traceback object, such as in sys.exc_traceback
add_strings_to_message(strings, color=None)[source]

Add strings to the message of this batch job.

Parameters:
  • strings – a list or generator of strings
  • color – the html color to be used for the strings (‘red’,

‘green’, ...), None if the color needs no change.

classmethod create(batch_job_type=None, status='running')[source]

Create a new batch job object in a session of its own. This allows flushing the batch job independent from other objects.

Parameters:
Returns:

a new BatchJob object

is_canceled()[source]

Verifies if this Batch Job is canceled. Returns True if it is. This method is thus suiteable to call inside a running batch job to verifiy if another user has canceled the running job. Create a batch job object through the create() method to make sure requesting the status does not interfer with the normal session.

Returns:True or False
class camelot.model.batch_job.BatchJobType(*args, **kwargs)[source]
The type of batch job, the user will be able to filter his
jobs based on their type. A type might be ‘Create management reports’
../../_images/new_view_batchjobtype.png

Fields :

  • name : VARCHAR(256), required
  • parent : refers to BatchJobType

Previous topic

authentication

Next topic

fixture

This Page