freezer.scheduler.scheduler_job module

class freezer.scheduler.scheduler_job.Job(scheduler, executable, job_doc)

Bases: object

ABORTED_RESULT = 'aborted'
ABORT_EVENT = 'abort'
COMPLETED_STATUS = 'completed'
FAIL_RESULT = 'fail'
LOCK_RETRY_BASE_SECONDS = 60
LOCK_RETRY_MAX_SECONDS = 3600
NON_TRIGGER_SCHEDULE_KEYS: frozenset[str] = frozenset({'current_pid', 'event', 'result', 'status', 'time_ended', 'time_started'})
NO_EVENT = ''
REMOVED_STATUS = 'removed'
REMOVE_EVENT = 'remove'
RUNNING_STATUS = 'running'
RUNTIME_SCHEDULE_KEYS: tuple[str, ...] = ('status', 'result', 'time_started', 'time_ended', 'current_pid')
SCHEDULED_STATUS = 'scheduled'
START_EVENT = 'start'
STOP_EVENT = 'stop'
STOP_STATUS = 'stop'
SUCCESS_RESULT = 'success'
TIME_NULL = -1
can_be_removed()
check_capabilities()

Check if the requested capabilities are available.

Returns:

True if the job can be executed on this node

Return type:

bool

contains_exec()
static create(scheduler, executable, job_doc)
end_session(result)
property event
execute()
execute_job_action(job_action)
finish()
get_schedule_args()
property id
is_running()
property job_doc_status
kill()
process_agent_output(output_string)

Process action execution output string from freezer-agent :param output_string: stdout serialized to json string

process_event(job_doc)
refresh_job_doc(job_doc: dict[str, Any]) bool

Adopt the definition carried by a freshly fetched job doc.

This is the only path by which a definition changed through the API reaches a job that is already scheduled. job_doc is as returned by the API or read from the jobs directory.

Returns True if the scheduling parameters changed, meaning an already-armed job has to be re-armed with the new trigger.

remove()
reschedule() None
property result
static save_action_to_file(action, f)
schedule()
property schedule_cron_fields
property schedule_date
property schedule_end_date
property schedule_interval
property schedule_start_date
property scheduled
property session_id
property session_tag
start_session()
terminate()
unschedule()
update_job_schedule_doc(**kwargs)

Updates the job_schedule section of the job doc with the provided keyword args. No checks about accepted key/values are being made here since they may vary in the future.

Parameters:

kwargs – keyword args to add

Returns:

None

class freezer.scheduler.scheduler_job.RunningState

Bases: object

static abort(job, doc)
static remove(job)
static start(job, doc)
static stop(job, doc)
class freezer.scheduler.scheduler_job.ScheduledState

Bases: object

static abort(job, doc)
static remove(job)
static start(job, doc)
static stop(job, doc)
class freezer.scheduler.scheduler_job.StopState

Bases: object

static abort(job, doc)
static remove(job)
static start(job, doc)
static stop(job, doc)