API - Version 2‎ > ‎

Tasks

List Tasks

GET /projects/:project_id/tasks

Parameters


In URL:
  • project_id
Required:

Optional:



Request

{
TODO
}




Response

{
    "tasks": [
        {
            "id": "4eb1b471cddb136065000010",
            "Timestamper": {
                "created_at": 1320268913440000000,
                "updated_at": 1320268924000000000
            },
            "api_version": 2,
            "project_id": "4eb1b46fcddb13606500000d",
            "code_id": "4eb1b46fcddb13606500000e",
            "code_history_id": "4eb1b46fcddb13606500000f",
            "status": "complete",
            "code_name": "helloFromPythonOLFSEQETEM",
            "code_rev": "1",
            "instance_id": "i-fc6a5b9c",
            "start_time": 1320268924000000000,
            "end_time": 1320268924000000000,
            "actual_start_time": 1320268924000000000,
            "duration": 43,
            "actual_duration": 43,
            "actual_priority": 2,
            "actual_start_time_ms": 1713964546,
            "start_time_ms": 1713964546,
            "end_time_ms": 1713964589,
            "run_times": 1,
            "timeout": 3600,
            "payload": "[{\"class_name\": \"helloFromPythonOLFSEQETEM\", \"access_key\": \"helloFromPythonOLFSEQETEM\", \"code_name\": \"helloFromPythonOLFSEQETEM\"}]"
        }
    ]
}




Create/Enqueue a Task

POST /projects/:project_id/tasks

Parameters


In URL:
  • project_id
In JSON:
  • tasks - required - an array of tasks containing:
    • code_name —  required - the name of the Code to execute for this job. Name must match the name of a code package previously uploaded.
    • payload - required - the data payload for this particular task as a string.
    • priority — optional - priority queue to run the job in (0, 1, 2). 0 is default. 
    • timeout - optional - maximum runtime of your task in seconds. Maximum time is 3600 seconds (60 minutes). Default is 3600 seconds (60 minutes).  


Request

{
    "tasks": [
        {
            "name": "helloFromPythonOLFSEQETEM",
            "code_name": "helloFromPythonOLFSEQETEM",
            "payload": "[{\"class_name\": \"helloFromPythonOLFSEQETEM\", \"access_key\": \"helloFromPythonOLFSEQETEM\", \"code_name\": \"helloFromPythonOLFSEQETEM\"}]"
        }
    ]
}



Response

An array of tasks is returned in the same order as the incoming array of tasks in the Request.

{
    "msg": "Queued up",
    "status_code": 200,
    "tasks": [
        {
            "id": "4eb1b471cddb136065000010"
        }
    ]
}




Get a Task

GET /projects/:project_id/tasks/:task_id


Parameters


In URL:
  • project_id
  • task_id
Required:

Optional:




Request

HTTP GET /2/projects/4eb1b46fcddb13606500000d/tasks/4eb1b471cddb136065000010?oauth=jTxYQDmMx5ZtVeZBT8jVx6oJDLw




Response

{
    "id": "4eb1b471cddb136065000010",
    "Timestamper": {
        "created_at": 1320268913440000000,
        "updated_at": 1320268924000000000
    },
    "api_version": 2,
    "project_id": "4eb1b46fcddb13606500000d",
    "code_id": "4eb1b46fcddb13606500000e",
    "code_history_id": "4eb1b46fcddb13606500000f",
    "status": "complete",
    "code_name": "helloFromPythonOLFSEQETEM",
    "code_rev": "1",
    "instance_id": "i-fc6a5b9c",
    "start_time": 1320268924000000000,
    "end_time": 1320268924000000000,
    "actual_start_time": 1320268924000000000,
    "duration": 43,
    "actual_duration": 43,
    "actual_priority": 2,
    "actual_start_time_ms": 1713964546,
    "start_time_ms": 1713964546,
    "end_time_ms": 1713964589,
    "run_times": 1,
    "timeout": 3600,
    "payload": "[{\"class_name\": \"helloFromPythonOLFSEQETEM\", \"access_key\": \"helloFromPythonOLFSEQETEM\", \"code_name\": \"helloFromPythonOLFSEQETEM\"}]"
}




Get a Task Log

GET /projects/:project_id/tasks/:task_id/log

This method returns the task log (everything written to STDOUT/STDERR) in ASCII FORMAT

Parameters


In URL:
  • project_id
  • task_id
Required:

Optional:




Request

HTTP GET /2/projects/4eb1b46fcddb13606500000d/tasks/4eb1b471cddb136065000010/log?oauth=jTxYQDmMx5ZtVeZBT8jVx6oJDLw




Response


Response is in "text/plain" format and includes the log only. 

Hello World!


Delete a Task

DELETE /projects/:project_id/tasks/:task_id


Parameters


In URL:
  • project_id
  • task_id

Response

{
    "msg": "Deleted"
}


Cancel a Task

POST /projects/:project_id/task/:task_id/cancel

Canelling a task will prevent it from running if it has not started.

Parameters


In URL:
  • project_id
  • schedule_id

Response

{
    "msg": "Cancelled"
}


Set Task Progress

POST /projects/:project_id/tasks/:task_id/progress

This method can be used to update the progress of a task while it's running. This is particularly useful for updating a user interface with progress information. To get the values you set here, task GET method above. 


Parameters


In URL:
  • project_id
  • task_id
Required:

Optional:

  • percent - A percentage value that can be set to show how much progress a task is making
  • msg - A human readable message string that can be used when showing the status of a task 


Request

{
TODO
}



Response

{
TODO
}




Comments