-
Notifications
You must be signed in to change notification settings - Fork 47
API Documentation
Job API |
---|
Start Job |
Repository API |
---|
Get all job definitions |
List head revisions' numbers |
List all revisions |
Get a job definition |
Get specific revision of a job definition |
Create/update job definition |
Starts a new job in an asynchronous mode and immediately returns job id.
Can be also run in synchronous mode using :sync
request attribute.
Request method | Content type | Syntax |
---|---|---|
POST | application/transit+json application/transit+msgpack |
/systems/{system id}/jobs |
Request Attribute | Type | Use |
---|---|---|
:jobdef-name | String | job definition name |
:revision | String | job definition revision |
:jobdef | map | Alternatively, an anonymous job definition can be provided instead of job definition name |
:properties | map | Overwrite values of job properties |
:files | map | Files to be stored into job folder before the job is started. The format of the attribute is {"file name" #bytes} |
:sync | Boolean | Should block till the job is finished? Defaults to false. |
Returns job id of the newly created job.
Success Return Code |
---|
201 |
{:jobid "517823b5-ecee-4326-ad5e-f8e03d6214c5"}
{:properties {:name "World", :message "Hello World!"},
:step-start #inst"2018-10-19T07:16:59.562-00:00",
:step-retries {},
:tracking-id nil,
:jobdef {:first-step "step1",
:name "test",
:type nil,
:properties {:name "World"},
:steps [{:id "step1",
:type :custom,
:supertype :tasklet,
:next [[false "step2"] [true "step3"]],
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]
{:message (str \"Hello \" (:name p)) :return-code (nil? (:name p))})",
:type nil},
:properties {}}
{:id "step2",
:type :custom,
:supertype :tasklet,
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"!\")})",
:type nil},
:next [],
:properties {}}
{:id "step3",
:type :custom,
:supertype :tasklet,
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]
{:message (str (:message p) \"nobody!\")})",
:type nil},
:next [],
:properties {}}],
:revision 2},
:commands-ch nil,
:step-state :completed,
:jobdir "/home/miro/Dropbox/titanoboa/dev-resources/job-folders/91230d16-4d51-4f78-b3bc-c6486fd6b8fb",
:start #inst"2018-10-19T07:16:59.553-00:00",
:history [{:step-state :completed,
:start #inst"2018-10-19T07:16:59.554-00:00",
:duration 2,
:result false,
:node-id "127.0.1.1:3000",
:id "step1",
:next-step "step2",
:exception nil,
:end #inst"2018-10-19T07:16:59.556-00:00",
:retry-count nil,
:thread-stack nil,
:message "Step [step1] finshed with result [false] of type class java.lang.Boolean\n"}
{:id "step2",
:step-state :running,
:start #inst"2018-10-19T07:16:59.562-00:00",
:node-id "127.0.1.1:3000",
:retry-count 0}
{:step-state :completed,
:start #inst"2018-10-19T07:16:59.562-00:00",
:duration 2,
:result nil,
:node-id "127.0.1.1:3000",
:id "step2",
:next-step nil,
:exception nil,
:end #inst"2018-10-19T07:16:59.564-00:00",
:retry-count nil,
:thread-stack nil,
:message "Step [step2] finshed with result [] of type \n"}],
:duration 11,
:state :finished,
:map-steps nil,
:aggregator-notif-ch nil,
:jobid "91230d16-4d51-4f78-b3bc-c6486fd6b8fb",
:callback-ch "clojure.core.async.impl.channels.ManyToManyChannel@358ec3bb",
:create-folder? true,
:node-id "127.0.1.1:3000",
:next-step nil,
:end #inst"2018-10-19T07:16:59.564-00:00",
:step {:id "step2",
:type :custom,
:supertype :tasklet,
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"!\")})", :type nil},
:next [],
:properties {}}}
Get latest revision of all job definitions in the repository.
Request method | Content type | Syntax |
---|---|---|
GET | application/transit+json application/transit+msgpack |
/repo/jobdefinitions |
Returns a map of all job definitions that exist in the repository. For each job definition, only the latest (head) revision is returned.
{"test" {:first-step "step1",
:name "test",
:type nil,
:properties {:name "World"},
:steps [{:id "step1",
:type :custom,
:supertype :tasklet,
:next [[false "step2"] [true "step3"]],
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]
{:message (str \"Hello \" (:name p)) :return-code (nil? (:name p))})",
:type nil},
:properties {}}
{:id "step2",
:type :custom,
:supertype :tasklet,
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"!\")})",
:type nil},
:next [],
:properties {}}
{:id "step3",
:type :custom,
:supertype :tasklet,
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]
{:message (str (:message p) \"nobody!\")})",
:type nil},
:next [],
:properties {}}],
:revision 2}}
Request method | Content type | Syntax |
---|---|---|
GET | application/transit+json application/transit+msgpack |
/repo/jobdefinitions/heads |
Returns a map of the latest revision number of each job definition that exists in the repository.
{"test" 2}
Request method | Content type | Syntax |
---|---|---|
GET | application/transit+json application/transit+msgpack |
repo/jobdefinitions/revisions |
Returns a map of job definitions. For each job definition name as key, the map contains their respective list of revisions which in turn consists of a vector of revision number, its timestamp, author and revision notes.
{"test" ([2 #inst"2018-10-03T10:28:27.000-00:00" "miro" "dolor sit amet, consectetur adipiscing elit"]
[1 #inst"2018-10-03T10:28:26.000-00:00" "anonymous" "lorem ipsum"])}
Request method | Content type | Syntax |
---|---|---|
GET | application/transit+json application/transit+msgpack |
/repo/jobdefinitions/{job definition's name} |
Returns a head revision of given job definitions.
{:first-step "step1",
:name "test",
:type nil,
:properties {:name "World"},
:steps [{:id "step1",
:type :custom,
:supertype :tasklet,
:next [[false "step2"] [true "step3"]],
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]
{:message (str \"Hello \" (:name p)) :return-code (nil? (:name p))})",
:type nil},
:properties {}}
{:id "step2",
:type :custom,
:supertype :tasklet,
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"!\")})",
:type nil},
:next [],
:properties {}}
{:id "step3",
:type :custom,
:supertype :tasklet,
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"nobody!\")})",
:type nil},
:next [],
:properties {}}],
:revision 2}
Request method | Content type | Syntax |
---|---|---|
GET | application/transit+json application/transit+msgpack |
/repo/jobdefinitions/{job definition's name}/{revision} |
Returns the specified revision of given job definitions.
{:first-step "step1",
:name "test",
:type nil,
:properties {:name "World"},
:steps [{:id "step1",
:type :custom,
:supertype :tasklet,
:next [[false "step2"] [true "step3"]],
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]
{:message (str \"Hello \" (:name p)) :return-code (nil? (:name p))})",
:type nil},
:properties {}}
{:id "step2",
:type :custom,
:supertype :tasklet,
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"!\")})",
:type nil},
:next [],
:properties {}}
{:id "step3",
:type :custom,
:supertype :tasklet,
:workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"nobody!\")})",
:type nil},
:next [],
:properties {}}],
:revision 1}
Adds a new revision of a job definition. If the job definition does not exists yet, it will be created.
Request method | Content type | Syntax |
---|---|---|
POST | application/transit+json application/transit+msgpack |
/repo/jobdefinitions/{job definition's name} |
Request Attribute | Type | Use |
---|---|---|
:definition | map | job definition map |
:notes | String | revision notes |
Returns number of new revision that was created.
3