View Source Lightning.Workflows.Job (Lightning v2.10.4)
Ecto model for Jobs.
A Job contains the fields for defining a job.
body
The expression/javascript codename
A plain text identifieradaptor
An NPM style string that contains both the module name and it's version. E.g.@openfn/language-http@v1.2.3
or@openfn/language-foo@latest
. While the version suffix isn't enforced here as it's not strictly necessary in this context, the front end will ensure a version is stated (@latest
being the default).
Summary
Functions
Attaches a workflow to a job, this is useful when you have an unpersisted Workflow changeset - and want it to be created at the same time as a Job.
Types
@type t() :: %Lightning.Workflows.Job{ __meta__: Ecto.Schema.Metadata.t(), adaptor: String.t() | nil, body: String.t() | nil, credential: nil | Lightning.Credentials.Credential.t() | Ecto.Association.NotLoaded.t(), delete: term(), id: Ecto.UUID.t() | nil, inserted_at: term(), name: String.t() | nil, project: term(), project_credential: term(), project_credential_id: term(), steps: term(), updated_at: term(), workflow: nil | Lightning.Workflows.Workflow.t() | Ecto.Association.NotLoaded.t(), workflow_id: term() }
Functions
@spec put_workflow( Ecto.Changeset.t(t()), Ecto.Changeset.t(Lightning.Workflows.Workflow.t()) ) :: Ecto.Changeset.t(t())
Attaches a workflow to a job, this is useful when you have an unpersisted Workflow changeset - and want it to be created at the same time as a Job.
Example:
workflow =
Ecto.Changeset.cast(
%Lightning.Workflows.Workflow{},
%{ "project_id" => attrs[:project_id], "id" => Ecto.UUID.generate() },
[:project_id, :id]
)
job =
%Job{}
|> Ecto.Changeset.change()
|> Job.put_workflow(workflow)
|> Job.changeset(attrs)