prefect.server.models.workers
Functions for interacting with worker ORM objects.
Intended for internal use by the Prefect REST API.
Functions
create_work_pool
session
: a database sessionwork_pool
: a WorkPool model
- orm_models.WorkPool: the newly-created WorkPool
read_work_pool
session
: A database sessionwork_pool_id
: a WorkPool id
- orm_models.WorkPool: the WorkPool
read_work_pool_by_name
session
: A database sessionwork_pool_name
: a WorkPool name
- orm_models.WorkPool: the WorkPool
read_work_pools
session
: A database sessionoffset
: Query offsetlimit
: Query limit
count_work_pools
session
: A database sessionwork_pool_filter
: filter criteria to apply to the count
update_work_pool
session
: A database sessionwork_pool_id
: a WorkPool idworker
: the work queue dataemit_status_change
: function to call when work pool status is changed
- whether or not the worker was updated
delete_work_pool
session
: A database sessionwork_pool_id
: a work pool id
- whether or not the WorkPool was deleted
get_scheduled_flow_runs
session
: a database sessionwork_pool_ids
: a list of work pool idswork_queue_ids
: a list of work pool queue idsscheduled_before
: a datetime to filter runs scheduled beforescheduled_after
: a datetime to filter runs scheduled afterrespect_queue_priorities
: whether or not to respect queue prioritieslimit
: the maximum number of runs to returndb
: a database interface
- List[WorkerFlowRunResponse]: the runs, as well as related work pool details
create_work_queue
session
: a database sessionwork_pool_id
: a work pool idwork_queue
: a WorkQueue action model
- orm_models.WorkQueue: the newly-created WorkQueue
bulk_update_work_queue_priorities
new_priorities
. For example, if no queues currently have the provided
new_priorities
, then they are assigned without affecting other queues. If
they are held by other queues, then those queues’ priorities are
incremented as necessary.
Updating queue priorities is not a common operation (happens on the same scale as
queue modification, which is significantly less than reading from queues),
so while this implementation is slow, it may suffice and make up for that
with extreme simplicity.
read_work_queues
session
: a database sessionwork_pool_id
: a work pool idwork_queue_filter
: Filter criteria for work pool queuesoffset
: Query offsetlimit
: Query limit
- List[orm_models.WorkQueue]: the WorkQueues
read_work_queue
session
: a database sessionwork_queue_id
: a work pool queue id
- orm_models.WorkQueue: the WorkQueue
read_work_queue_by_name
session
: A database sessionwork_pool_name
: a WorkPool namework_queue_name
: a WorkQueue name
- orm_models.WorkQueue: the WorkQueue
update_work_queue
session
: a database sessionwork_queue_id
: a work pool queue IDwork_queue
: a WorkQueue modelemit_status_change
: function to call when work queue status is changed
- whether or not the WorkQueue was updated
delete_work_queue
session
: a database sessionwork_queue_id
: a work pool queue ID
- whether or not the WorkQueue was deleted
read_workers
worker_heartbeat
session
: a database sessionwork_pool_id
: a work pool IDworker_name
: a worker name
- whether or not the worker was updated
delete_worker
session
: a database sessionwork_pool_id
: a work pool IDworker_name
: a worker name
- whether or not the Worker was deleted