Adding StopTask endpoint and endpoint documentation

This commit is contained in:
Ian Roddis
2022-02-22 10:32:31 -04:00
parent 0ee198e3e7
commit b63739c0a9
5 changed files with 231 additions and 0 deletions

201
endpoints.rst Normal file
View File

@@ -0,0 +1,201 @@
Paths
===
+----------------------------------------------+--------+---------------------------------------------------------------------------+--------------------+-------------------------------+
| Path | Verb | Description | Payload | Result |
+==============================================+========+===========================================================================+====================+===============================+
| ``/ready`` | GET | Ready check | | ``{ "msg": "Ya like DAGs?"}`` |
+----------------------------------------------+--------+---------------------------------------------------------------------------+--------------------+-------------------------------+
| ``/v1/dagruns?all=1`` | GET | Retrieve list of known dags | | :ref:`Example List of Runs` |
+----------------------------------------------+--------+---------------------------------------------------------------------------+--------------------+-------------------------------+
| ``/v1/dagrun`` | POST | Submit a DAG for execution | :ref:`Example DAG` | ``{ "runID": 0 }`` |
+----------------------------------------------+--------+---------------------------------------------------------------------------+--------------------+-------------------------------+
| ``/v1/dagrun/validate`` | POST | Submit a DAG for validation | :ref:`Example DAG` | ``{ "valid": true }`` |
+----------------------------------------------+--------+---------------------------------------------------------------------------+--------------------+-------------------------------+
| ``/v1/dagrun/{runid}`` | GET | Retrieve full state of dagrun | | :ref:`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. | | :ref:`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
===
.. 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
===
.. 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
===
.. 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
===
.. code:: json
{
"maxRetries": 0,
"retryIntervalSeconds": 0,
"job": {
"environment": [],
"memoryMB": "100",
"cores": "1",
"command": [
"/usr/bin/python3",
"script.py",
"1"
]
},
"children": [],
"parents": [],
"isGenerator": false
}