queue.messages package

Submodules

queue.messages.queued_jobs module

Defines a command message that sets QUEUED status for job models

class queue.messages.queued_jobs.QueuedJob(job_id, exe_num)

Bases: tuple

exe_num

Alias for field number 1

job_id

Alias for field number 0

class queue.messages.queued_jobs.QueuedJobs

Bases: messaging.messages.message.CommandMessage

Command message that sets QUEUED status for job models

add_job(job_id, exe_num)

Adds the given job to this message

Parameters:
  • job_id (int) – The job ID
  • exe_num (int) – The job’s execution number (0 if the job has never been queued)
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()

queue.messages.queued_jobs.create_queued_jobs_messages(jobs, requeue=False, priority=None)

Creates messages to queue the given jobs

Parameters:
  • jobs (list()) – The jobs to queue (QueuedJob tuple)
  • requeue (bool) – Whether this is a re-queue (True) or a first queue (False)
  • priority (int) – Optional priority to set on the queued jobs
Returns:

The list of messages

Return type:

list()

queue.messages.requeue_jobs module

Defines a command message that re-queues job models

class queue.messages.requeue_jobs.RequeueJobs

Bases: messaging.messages.message.CommandMessage

Command message that re-queues job models

add_job(job_id, exe_num)

Adds the given job to this message

Parameters:
  • job_id (int) – The job ID
  • exe_num (int) – The job’s execution number
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()

queue.messages.requeue_jobs.create_requeue_jobs_messages(jobs, priority=None)

Creates messages to requeue the given jobs

Parameters:
  • jobs (list()) – The jobs to requeue
  • priority (int) – Optional priority to set on the re-queued jobs
Returns:

The list of messages

Return type:

list()

queue.messages.requeue_jobs_bulk module

Defines a command message that performs a bulk re-queue operation

class queue.messages.requeue_jobs_bulk.RequeueJobsBulk

Bases: messaging.messages.message.CommandMessage

Command message that performs a bulk re-queue 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()

queue.messages.requeue_jobs_bulk.create_requeue_jobs_bulk_message(started=None, ended=None, error_categories=None, error_ids=None, job_ids=None, job_type_ids=None, priority=None, status=None, job_type_names=None, batch_ids=None, recipe_ids=None, is_superseded=None)

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

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
  • priority (int) – A new priority for the re-queued jobs
  • 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:

queue.messages.requeue_jobs_bulk.RequeueJobsBulk

Module contents