API Reference

Core Types

DynamicWorkflow.JobType

A job that can be scheduled and run. The uuid is used to identify the job and the result.

Fields

  • name

  • uuid

  • context

  • task

  • output

  • status

source
DynamicWorkflow.OutputRefType

Placeholder for a job result that may not exist yet (like Future). The UUID is the same as the associated job.

Fields

  • uuid

  • result

source
DynamicWorkflow.JobSchedulerType

The central scheduler for jobs. Only one global instance of JobScheduler should exist and is created by start_scheduler.

Fields

  • jobs

  • pending

  • running

  • completed

  • g

  • node2id

  • id2node

  • lock

  • mainloop

source

Main Functions

DynamicWorkflow.@jobMacro
@job f(args...)

Wrap a function call and create a job which will be submitted immediately to the global JobScheduler. Functions are plain Julia functions — no special first argument needed.

Parent-child relationships are tracked automatically via task-local storage when @job is called inside a running job.

Examples

my_add(x, y) = x + y
j1 = @job my_add(1, 2)
j2 = @job my_add(3, 2)
j3 = @job my_add(j1, j2)  # j3 depends on j1 and j2
source
Base.fetchFunction
fetch(job::Job)

Get the result of a job, blocking until the job is completed.

source
DynamicWorkflow.cancel!Function
cancel!(job, js)

Try to cancel a job from running.

Returns

true if the job was successfully cancelled, false otherwise

source
DynamicWorkflow.current_contextFunction
current_context() -> Union{Nothing, JobContext}

Return the JobContext of the currently executing job, or nothing if called outside a job. Uses Julia task_local_storage for implicit context propagation.

source
DynamicWorkflow.headFunction
head(uuid::UUID) -> String

Extract the first part of a UUID string (before the first hyphen).

source

Visualization

DynamicWorkflow.draw_graphFunction
draw_graph(js; layout)

Draw workflow graph. Default layout is hierarchical, can take layouts defined in NetworkLayout.jl.

source
DynamicWorkflow.hierarchical_layoutFunction

Compute top-down hierarchical positions for a DAG similar to DOT. Each node's layer equals its longest path from any source. Nodes within the same layer are evenly spaced on the x-axis. Returns a Vector{Point2f} suitable for graphplot(layout=...).

source

Internals