pyfarm.models.task module¶
Task Models¶
Models and interface classes related to tasks
-
class
pyfarm.models.task.
Task
(**kwargs)[source]¶ Bases:
flask_sqlalchemy.Model
,pyfarm.models.core.mixins.ValidatePriorityMixin
,pyfarm.models.core.mixins.ValidateWorkStateMixin
,pyfarm.models.core.mixins.UtilityMixins
,pyfarm.models.core.mixins.ReprMixin
Defines a task which a child of a
Job
. This table represents rows which contain the individual work unit(s) for a job.-
REPR_COLUMNS
= ('id', 'state', 'frame', 'project')¶
-
REPR_CONVERT_COLUMN
= {'state': functools.partial(<function repr_enum at 0x7f04edb25e18>, enum=['running', 'paused', 'failed', 'done', None])}¶
-
STATE_DEFAULT
= None¶
-
STATE_ENUM
= ['running', 'paused', 'failed', 'done', None]¶
-
agent
¶
-
agent_id
¶ Foreign key which stores
Job.id
-
attempts
¶ The number of attempts which have been made on this task. This value is auto incremented when
state
changes to a value synonymous with a running state.
-
static
clear_error_state
(target, new_value, old_value, initiator)[source]¶ Sets
last_error
column toNone
if the task’s state is ‘done’
-
failed_in_agents
¶
-
failures
¶ The number of times this task has failed. This value is auto incremented when
state
changes to a value synonymous with a failed state.
When True this hides the task from queue and web ui
-
id
¶ Provides an id for the current row. This value should never be directly relied upon and it’s intended for use by relationships.
-
job
¶ relationship attribute which retrieves the associated job for this task
-
job_id
¶ Foreign key which stores
Job.id
-
last_error
¶ This column may be set when an error is present. The agent typically sets this column when the job type either can’t or won’t run a given task. This column will be cleared whenever the task’s state is returned to a non-error state.
-
log_associations
¶
-
priority
¶ The priority of the job relative to others in the queue. This is not the same as task priority.
configured by: job.priority
-
progress
¶ The progress for this task, as a value between 0.0 and 1.0. Used purely for display purposes.
-
sent_to_agent
¶ Whether this task was already sent to the assigned agent
-
static
set_times
(target, new_value, old_value, initiator)[source]¶ update the datetime objects depending on the new value
-
state
¶ The state of the job with a value provided by
WorkState
-
tile
¶ When using tiled rendering, the number of the tile this task refers to. The jobtype will have to translate that into an actual image region. This will be NULL if the job doesn’t use tiled rendering.
-
time_finished
¶ Time the job was finished. This will be set when the last task finishes and reset if a job is requeued.
-
time_started
¶ The time this job was started. By default this value is set when
state
is changed to an appropriate value or when a job is requeued.
-
time_submitted
¶ The time the job was submitted. By default this defaults to using
datetime.datetime.utcnow()
as the source of submission time. This value will not be set more than once and will not change even after a job is requeued.
-