job.messages package

Submodules

job.messages.blocked_jobs module

Defines a command message that sets BLOCKED status for job models

class job.messages.blocked_jobs.BlockedJobs

Bases: messaging.messages.message.CommandMessage

Command message that sets BLOCKED status for job models

add_job(job_id)

Adds the given job ID to this message

Parameters:job_id (int) – The job ID
can_fit_more()

Indicates whether more jobs can fit in this message

Returns:True if more jobs can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.blocked_jobs.create_blocked_jobs_messages(blocked_job_ids, when)

Creates messages to update the given job IDs to BLOCKED

Parameters:
  • blocked_job_ids (list()) – The job IDs
  • when (datetime.datetime) – The current time
Returns:

The list of messages

Return type:

list()

job.messages.cancel_jobs module

Defines a command message that cancels job models

class job.messages.cancel_jobs.CancelJobs

Bases: messaging.messages.message.CommandMessage

Command message that cancels job models

add_job(job_id)

Adds the given job to this message

Parameters:job_id (int) – The job ID
can_fit_more()

Indicates whether more jobs can fit in this message

Returns:True if more jobs can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.cancel_jobs.create_cancel_jobs_messages(job_ids, when)

Creates messages to cancel the given jobs

Parameters:
  • job_ids (list()) – The job IDs to cancel
  • when (datetime.datetime) – The cancel time
Returns:

The list of messages

Return type:

list()

job.messages.cancel_jobs_bulk module

Defines a command message that performs a bulk cancel operation

class job.messages.cancel_jobs_bulk.CancelJobsBulk

Bases: messaging.messages.message.CommandMessage

Command message that performs a bulk cancel operation

execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.cancel_jobs_bulk.create_cancel_jobs_bulk_message(started=None, ended=None, error_categories=None, error_ids=None, job_ids=None, job_type_ids=None, status=None, job_type_names=None, batch_ids=None, recipe_ids=None, is_superseded=None)

Creates a message to perform a bulk job cancel operation. The parameters are applied as filters to the jobs affected by the cancel.

Parameters:
  • started (datetime.datetime) – The start time of the jobs
  • ended (datetime.datetime) – The end time of the jobs
  • error_categories (list()) – A list of error categories
  • error_ids (list()) – A list of error IDs
  • job_ids (list()) – A list of job IDs
  • job_type_ids (list()) – A list of job type IDs
  • status (str) – The job status
  • job_type_names (list()) – A list of job type names
  • batch_ids (list()) – A list of batch IDs
  • recipe_ids (list()) – A list of recipe IDs
  • is_superseded (boolean) – Whether the jobs are superseded or not
Returns:

The message

Return type:

job.messages.cancel_jobs_bulk.CancelJobsBulk

job.messages.completed_jobs module

Defines a command message that sets COMPLETED status for job models

class job.messages.completed_jobs.CompletedJob(job_id, exe_num)

Bases: tuple

exe_num

Alias for field number 1

job_id

Alias for field number 0

class job.messages.completed_jobs.CompletedJobs

Bases: messaging.messages.message.CommandMessage

Command message that sets COMPLETED status for job models

add_completed_job(completed_job)

Adds the given completed job to this message

Parameters:completed_job (job.messages.completed_jobs.CompletedJob) – The completed job
can_fit_more()

Indicates whether more completed jobs can fit in this message

Returns:True if more completed jobs can fit, False otherwise
Return type:bool
execute(*args, **kwargs)
static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.completed_jobs.create_completed_jobs_messages(completed_jobs, when)

Creates messages to complete the given jobs

Parameters:
  • completed_jobs (list()) – The completed jobs
  • when (datetime.datetime) – When the jobs completed
Returns:

The list of messages

Return type:

list()

job.messages.completed_jobs.process_completed_jobs_with_output(job_ids, when)

Processes the given job IDs to determine if any of the jobs have both COMPLETED and received their output. Messages will be created and returned for completed jobs that have their output populated. Caller must have obtained model locks on the given jobs.

Parameters:
  • job_ids (list()) – The job IDs
  • when (datetime.datetime) – The current time
Returns:

The list of created messages

Return type:

list()

job.messages.create_jobs module

Defines a command message that creates job models

class job.messages.create_jobs.CreateJobs

Bases: messaging.messages.message.CommandMessage

Command message that creates job models

add_recipe_job(recipe_job)

Adds the given recipe job to this message to be created

Parameters:recipe_job (job.messages.create_jobs.RecipeJob) – The recipe job
can_fit_more()

Indicates whether more jobs can fit in this message

Returns:True if more jobs can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

class job.messages.create_jobs.RecipeJob(job_type_name, job_type_version, job_type_rev_num, node_name, process_input)

Bases: tuple

job_type_name

Alias for field number 0

job_type_rev_num

Alias for field number 2

job_type_version

Alias for field number 1

node_name

Alias for field number 3

process_input

Alias for field number 4

job.messages.create_jobs.create_jobs_message(job_type_name, job_type_version, job_type_rev_num, event_id, input_data)

Creates a message to create a job of the given type

Parameters:
  • job_type_name (string) – The job type name
  • job_type_version (string) – The job type version
  • job_type_rev_num (string) – The job type revision number
  • event_id (int) – The event ID
  • input_data (data.data.data.Data) – The input data for the job
Returns:

The message for creating the job

Return type:

job.messages.create_jobs.CreateJobs

job.messages.create_jobs.create_jobs_messages_for_recipe(recipe, recipe_jobs)

Creates messages to create jobs with a recipe

Parameters:
  • recipe (recipe.models.Recipe) – The recipe model
  • recipe_jobs (list()) – The list of RecipeJob tuples describing the jobs to create
Returns:

The list of messages

Return type:

list()

job.messages.failed_jobs module

Defines a command message that sets FAILED status for job models

class job.messages.failed_jobs.FailedJob(job_id, exe_num, error_id)

Bases: tuple

error_id

Alias for field number 2

exe_num

Alias for field number 1

job_id

Alias for field number 0

class job.messages.failed_jobs.FailedJobs

Bases: messaging.messages.message.CommandMessage

Command message that sets FAILED status for job models

add_failed_job(failed_job)

Adds the given failed job to this message

Parameters:failed_job (job.messages.failed_jobs.FailedJob) – The failed job
can_fit_more()

Indicates whether more failed jobs can fit in this message

Returns:True if more failed jobs can fit, False otherwise
Return type:bool
execute(*args, **kwargs)
static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.failed_jobs.create_failed_jobs_messages(failed_jobs, when)

Creates messages to fail the given jobs

Parameters:
  • failed_jobs (list()) – The failed jobs
  • when (datetime.datetime) – When the jobs failed
Returns:

The list of messages

Return type:

list()

job.messages.job_exe_end module

Defines a command message that creates job_exe_end models

class job.messages.job_exe_end.CreateJobExecutionEnd

Bases: messaging.messages.message.CommandMessage

Command message that creates job_exe_end models

add_job_exe_end(job_exe_end)

Adds the given job_exe_end model to this message

Parameters:job_exe_end (job.models.JobExecutionEnd) – The job_exe_end model to add
can_fit_more()

Indicates whether more job_exe_end models can fit in this message

Returns:True if more job_exe_end models can fit, False otherwise
Return type:bool
execute(*args, **kwargs)
static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.job_exe_end.create_job_exe_end_messages(job_exe_end_models)

Creates messages to create the given job_exe_end models

Parameters:job_exe_end_models (list()) – The job_exe_end models to create
Returns:The list of messages
Return type:list()

job.messages.pending_jobs module

Defines a command message that sets PENDING status for job models

class job.messages.pending_jobs.PendingJobs

Bases: messaging.messages.message.CommandMessage

Command message that sets PENDING status for job models

add_job(job_id)

Adds the given job ID to this message

Parameters:job_id (int) – The job ID
can_fit_more()

Indicates whether more jobs can fit in this message

Returns:True if more jobs can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.pending_jobs.create_pending_jobs_messages(pending_job_ids, when)

Creates messages to update the given job IDs to PENDING

Parameters:
  • pending_job_ids (list()) – The job IDs
  • when (datetime.datetime) – The current time
Returns:

The list of messages

Return type:

list()

job.messages.process_job_input module

Defines a command message that processes the input for a job

class job.messages.process_job_input.ProcessJobInput

Bases: messaging.messages.message.CommandMessage

Command message that processes the input for a job

execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.process_job_input.create_process_job_input_messages(job_ids)

Creates messages to process the input for the given jobs

Parameters:job_ids (list()) – The job IDs
Returns:The list of messages
Return type:list()

job.messages.publish_job module

Defines a command message that publishes a job

class job.messages.publish_job.PublishJob

Bases: messaging.messages.message.CommandMessage

Command message that publishes a completed job

execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.publish_job.create_publish_job_message(job_id)

Creates a publish job message

Parameters:job_id (int) – The job ID
Returns:The publish job message
Return type:job.messages.publish_job.PublishJob

job.messages.purge_jobs module

Defines a command message that purges jobs

class job.messages.purge_jobs.PurgeJobs

Bases: messaging.messages.message.CommandMessage

Command message that removes job models

add_job(job_id)

Adds the given job ID to this message

Parameters:job_id (int) – The job ID
can_fit_more()

Indicates whether more jobs can fit in this message

Returns:True if more jobs can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.purge_jobs.create_purge_jobs_messages(purge_job_ids, trigger_id, source_file_id)

Creates messages to remove the given job IDs

Parameters:
  • purge_job_ids (list()) – The job IDs
  • trigger_id (int) – The trigger event id for the purge operation
  • source_file_id (int) – The source file id for the original file being purged
Returns:

The list of messages

Return type:

list()

job.messages.running_jobs module

Defines a command message that sets RUNNING status for job models

class job.messages.running_jobs.RunningJobs(started=None)

Bases: messaging.messages.message.CommandMessage

Command message that sets RUNNING status for job models

add_running_job(job_id, exe_num, node_id)

Adds the given running job to this message

Parameters:
  • job_id (int) – The running job ID
  • exe_num (int) – The running job’s execution number
  • node_id (int) – The node ID that the job is running on
can_fit_more()

Indicates whether more running jobs can fit in this message

Returns:True if more running jobs can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.running_jobs.create_running_job_messages(running_job_exes)

Creates a list of running job messages for the given running job executions (they must all have the same start time)

Parameters:running_job_exes (list()) – The running job executions
Returns:The running job messages
Return type:list()

job.messages.spawn_delete_files_job module

Defines a command message that creates and queues a system job for deleting files

class job.messages.spawn_delete_files_job.SpawnDeleteFilesJob

Bases: messaging.messages.message.CommandMessage

Command message that spawns a delete files system job

execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.spawn_delete_files_job.create_spawn_delete_files_job(job_id, trigger_id, source_file_id, purge)

Creates a spawn delete files job message

Parameters:
  • job_id (int) – The job ID whose files will be deleted
  • trigger_id (int) – The trigger event id for the purge operation
  • source_file_id (int) – The source file id for the original file being purged
  • purge (bool) – Boolean value to determine if files should be purged from workspace
Returns:

The spawn delete files job message

Return type:

job.messages.spawn_delete_files_job.SpawnDeleteFilesJob

job.messages.uncancel_jobs module

Defines a command message that uncancels job models

class job.messages.uncancel_jobs.UncancelJobs

Bases: messaging.messages.message.CommandMessage

Command message that sets uncancels job models (jobs that have never been queued before)

add_job(job_id)

Adds the given job ID to this message

Parameters:job_id (int) – The job ID
can_fit_more()

Indicates whether more jobs can fit in this message

Returns:True if more jobs can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.uncancel_jobs.create_uncancel_jobs_messages(job_ids, when)

Creates messages to uncancel the given job IDs

Parameters:
  • job_ids (list()) – The job IDs
  • when (datetime.datetime) – The time the jobs were uncanceled
Returns:

The list of messages

Return type:

list()

job.messages.unpublish_jobs module

Defines a command message that unpublishes a list of jobs

class job.messages.unpublish_jobs.UnpublishJobs

Bases: messaging.messages.message.CommandMessage

Command message that punpublishes a list of jobs

add_job(job_id)

Adds the given job ID to this message

Parameters:job_id (int) – The job ID
can_fit_more()

Indicates whether more jobs can fit in this message

Returns:True if more jobs can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

job.messages.unpublish_jobs.create_unpublish_jobs_messages(job_ids, when)

Creates messages to unpublish the given jobs

Parameters:
  • job_ids (list()) – The job IDs to unpublish
  • when (datetime.datetime) – When the jobs were unpublished
Returns:

The list of messages

Return type:

list()

Module contents