View Source StepFlow.Workers.WorkerStatuses (StepFlow v1.8.0)
The WorkerStatuses context.
Summary
Functions
Creates a WorkerStatus.
Creates a WorkerStatus.
Gets the last inserted WorkerStatus.
Gets the last inserted WorkerStatus.
Gets the first WorkerStatus which is running a job which ID is job_id
.
Returns the list of WorkerStatuses.
Updates a WorkerStatus.
Functions
Creates a WorkerStatus.
Examples
iex> result = StepFlow.Workers.WorkerStatuses.create_worker_status!(%{
...> job: nil,
...> worker: %{
...> activity: "Idle",
...> description: "This worker is just an example.",
...> direct_messaging_queue_name: "direct_messaging_e1297fe6-fe94-49cf-9ef8-1a751cba28f2",
...> instance_id: "e1297fe6-fe94-49cf-9ef8-1a751cba28f2",
...> label: "UnitTestWorker",
...> queue_name: "job_test_worker",
...> sdk_version: "2.3.4",
...> short_description: "A test worker",
...> system_info: %{
...> docker_container_id: "e1297fe6-fe94-49cf-9ef8-1a751cba28f2",
...> number_of_processors: 12,
...> total_memory: 16_574_754,
...> total_swap: 2_046_816,
...> used_memory: 8_865_633,
...> used_swap: 0
...> },
...> version: "1.2.3"
...> }
...> })
...> match?(%StepFlow.Workers.WorkerStatus{}, result)
true
Returns {:ok, WorkerStatus}
on success, {:error, changeset}
otherwise.
Creates a WorkerStatus.
Examples
iex> result = StepFlow.Workers.WorkerStatuses.create_worker_status!(%{
...> job: nil,
...> worker: %{
...> activity: "Idle",
...> description: "This worker is just an example.",
...> direct_messaging_queue_name: "direct_messaging_e1297fe6-fe94-49cf-9ef8-1a751cba28f2",
...> instance_id: "e1297fe6-fe94-49cf-9ef8-1a751cba28f2",
...> label: "UnitTestWorker",
...> queue_name: "job_test_worker",
...> sdk_version: "2.3.4",
...> short_description: "A test worker",
...> system_info: %{
...> docker_container_id: "e1297fe6-fe94-49cf-9ef8-1a751cba28f2",
...> number_of_processors: 12,
...> total_memory: 16_574_754,
...> total_swap: 2_046_816,
...> used_memory: 8_865_633,
...> used_swap: 0
...> },
...> version: "1.2.3"
...> }
...> })
...> match?(%StepFlow.Workers.WorkerStatus{}, result)
true
Raises error if something went wrong during creation.
Gets the last inserted WorkerStatus.
Returns nil
if the Worker does not exist.
Gets the last inserted WorkerStatus.
Raises Ecto.NoResultsError
if the WorkerStatus does not exist.
Gets the first WorkerStatus which is running a job which ID is job_id
.
Returns nil
if that WorkerStatus does not exist.
Returns the list of WorkerStatuses.
Examples
iex> StepFlow.WorkerStatuses.list_worker_statuses()
%{data: [], page: 0, size: 10, total: 0}
Updates a WorkerStatus.
Examples
iex> result = StepFlow.Workers.WorkerStatuses.update_worker_status!(%{
...> job: %{
...> destination_paths: [],
...> execution_duration: 0.0,
...> job_id: 1234,
...> parameters: [],
...> status: "processing"
...> },
...> worker: %{
...> activity: "Idle",
...> description: "This worker is just an example.",
...> direct_messaging_queue_name: "direct_messaging_e1297fe6-fe94-49cf-9ef8-1a751cba28f2",
...> instance_id: "e1297fe6-fe94-49cf-9ef8-1a751cba28f2",
...> label: "UnitTestWorker",
...> queue_name: "job_test_worker",
...> sdk_version: "2.3.4",
...> short_description: "A test worker",
...> system_info: %{
...> docker_container_id: "e1297fe6-fe94-49cf-9ef8-1a751cba28f2",
...> number_of_processors: 12,
...> total_memory: 16_574_754,
...> total_swap: 2_046_816,
...> used_memory: 8_865_633,
...> used_swap: 0
...> },
...> version: "1.2.3"
...> }
...> })
...> match?(%StepFlow.Workers.WorkerStatus{}, result)
true
Raises error if something went wrong during update.