Files
daggy/endpoints.rst
2022-02-22 10:36:34 -04:00

210 lines
8.2 KiB
ReStructuredText

Paths
=====
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
| Path | Verb | Description | Payload | Result |
+==============================================+========+===========================================================================+================+===============================+
| ``/ready`` | GET | Ready check | | ``{ "msg": "Ya like DAGs?"}`` |
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
| ``/v1/dagruns?all=1`` | GET | Retrieve list of known dags | | `Example List of Runs`_ |
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
| ``/v1/dagrun`` | POST | Submit a DAG for execution | `Example DAG`_ | ``{ "runID": 0 }`` |
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
| ``/v1/dagrun/validate`` | POST | Submit a DAG for validation | `Example DAG`_ | ``{ "valid": true }`` |
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
| ``/v1/dagrun/{runid}`` | GET | Retrieve full state of dagrun | | `Example DAG Run`_ |
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
| ``/v1/dagrun/{runid}`` | DELETE | Kill a running DAG | | |
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
| ``/v1/dagrun/{runid}/state`` | GET | Retrieve current state of run | | ``{ "state": "QUEUED" }`` |
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
| ``/v1/dagrun/{runid}/state/{state}`` | PATCH | Set the state of a DAG Run. Can be used to restart an errored/killed DAG. | | ``{ "runID": 0 }`` |
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
| ``/v1/dagrun/{runid}/task/{taskName}`` | GET | Get all the details of a specific task. | | `Example Task Details`_ |
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
| ``/v1/dagrun/{runid}/task/{taskName}`` | DELETE | Kill a task | | |
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
| ``/v1/dagrun/{runid}/task/{taskName}/state`` | GET | Get the current state of a task | | ``{ "state": "QUEUED" }`` |
+----------------------------------------------+--------+---------------------------------------------------------------------------+----------------+-------------------------------+
.. _`Example List of Runs`:
Example List of Runs
====================
.. code:: json
[
{
"runID": 0,
"tag": "mediumtest",
"state": "COMPLETED",
"startTime": "1645112245996647771",
"lastUpdate": "1645112265427198113",
"taskCounts": {
"COMPLETED": 25
}
},
{
"runID": 1,
"tag": "mediumtest",
"state": "COMPLETED",
"startTime": "1645218441353189612",
"lastUpdate": "1645218455775103710",
"taskCounts": {
"COMPLETED": 25
}
},
{
"runID": 2,
"tag": "mediumtest",
"state": "RUNNING",
"startTime": "1645539903281234588",
"lastUpdate": "1645539912499992547",
"taskCounts": {
"COMPLETED": 11,
"RUNNING": 14
}
}
]
.. _`Example DAG`:
Example DAG
===========
.. code:: json
{
"tag": "mediumtest",
"parameters": {
"JOBNO": [
"1", "2"
]
},
"tasks": {
"simple": {
"job": {
"command": [ "/usr/bin/python3", "script.py", "{{JOBNO}}" ],
"cores": "1",
"memoryMB": "100"
}
}
}
}
.. _`Example DAG Run`:
Example DAG Run
===============
.. code:: json
{
"runID": 0,
"tag": "mediumtest",
"tasks": {
"simple_0": {
"maxRetries": 0,
"retryIntervalSeconds": 0,
"job": {
"environment": [],
"memoryMB": "100",
"cores": "1",
"command": [
"/usr/bin/python3",
"script.py",
"1"
]
},
"children": [],
"parents": [],
"isGenerator": false
},
"simple_1": {
"maxRetries": 0,
"retryIntervalSeconds": 0,
"job": {
"environment": [],
"memoryMB": "100",
"cores": "1",
"command": [
"/usr/bin/python3",
"script.py",
"2"
]
},
"children": [],
"parents": [],
"isGenerator": false
}
},
"taskStates": {
"simple_0": "COMPLETED",
"simple_1": "COMPLETED"
},
"taskAttempts": {
"simple_0": [
{
"startTime": "1645112246001010638",
"stopTime": "1645112256116473300",
"rc": 0,
"outputLog": "Echoing script.py 1 env is not found, value is >><< \n",
"errorLog": "",
"executorLog": ""
}
],
"simple_1": [
{
"startTime": "1645112246001027500",
"stopTime": "1645112256115818901",
"rc": 0,
"outputLog": "Echoing script.py 2 env is not found, value is >><< \n",
"errorLog": "",
"executorLog": ""
}
]
},
"dagStateChanges": [
{
"time": "1645112245996647771",
"state": "QUEUED"
},
{
"time": "1645112245997607895",
"state": "RUNNING"
},
{
"time": "1645112265427198113",
"state": "COMPLETED"
}
]
}
.. _`Example Task Details`:
Example Task Details
====================
.. code:: json
{
"maxRetries": 0,
"retryIntervalSeconds": 0,
"job": {
"environment": [],
"memoryMB": "100",
"cores": "1",
"command": [
"/usr/bin/python3",
"script.py",
"1"
]
},
"children": [],
"parents": [],
"isGenerator": false
}