pyfarm.master.api.tasklogs module¶
Task Logs¶
This module defines an API for managing and querying logs belonging to tasks
-
class
pyfarm.master.api.tasklogs.
LogsInTaskAttemptsIndexAPI
[source]¶ Bases:
flask.views.MethodView
-
get
(job_id, task_id, attempt)[source]¶ A
GET
to this endpoint will return a list of all known logs that are associated with this attempt at running this task-
GET
/api/v1/jobs/<job_id>/tasks/<task_id>/attempts/<attempt>/logs/ HTTP/1.1
¶ Request
GET /api/v1/jobs/4/tasks/1300/attempts/5/logs/ HTTP/1.1 Accept: application/json
Response
HTTP/1.1 200 OK Content-Type: application/json [ { "agent_id": "3087ada4-290a-45b0-8c1a-21db4cd284fc", "created_on": "2014-09-03T10:58:59.754880", "identifier": "2014-09-03_10-58-59_4_4ee02475335911e4a935c86000cbf5fb.csv" } ]
Statuscode 200: no error Statuscode 404: the specified task was not found -
-
methods
= ['GET', 'POST']¶
-
post
(job_id, task_id, attempt)[source]¶ A
POST
to this endpoint will register a new logfile with the given attempt at running the given taskA logfile has an identifier which must be unique in the system. If two tasks get assigned a logfile with the same id, it is considered to be the same log.
-
POST
/api/v1/jobs/<job_id>/tasks/<task_id>/attempts/<attempt>/logs/ HTTP/1.1
¶ Request
POST /api/v1/jobs/4/tasks/1300/attempts/5/logs/ HTTP/1.1 Content-Type: application/json { "identifier": "2014-09-03_10-58-59_4_4ee02475335911e4a935c86000cbf5fb.csv", "agent_id": "2dc2cb5a-35da-41d6-8864-329c0d7d5391" }
Response
HTTP/1.1 201 CREATED Content-Type: application/json { "identifier": "2014-09-03_10-58-59_4_4ee02475335911e4a935c86000cbf5fb.csv", "agent_id": "2dc2cb5a-35da-41d6-8864-329c0d7d5391", "created_on": "2014-09-03T10:59:05.103005", "id": 148 }
Statuscode 201: the association between this task attempt and logfile has been created Statuscode 400: there was something wrong with the request (such as invalid columns being included) Statuscode 404: the specified task does not exist Statuscode 409: the specified log was already registered on the specified task -
-
-
class
pyfarm.master.api.tasklogs.
SingleLogInTaskAttempt
[source]¶ Bases:
flask.views.MethodView
-
get
(job_id, task_id, attempt, log_identifier)[source]¶ A
GET
to this endpoint will return metadata about the specified logfile-
GET
/api/v1/jobs/<job_id>/tasks/<task_id>/attempts/<attempt>/logs/<log_identifier> HTTP/1.1
¶ Request
GET /api/v1/jobs/4/tasks/1300/attempts/5/logs/2014-09-03_10-58-59_4_4ee02475335911e4a935c86000cbf5fb.csv HTTP/1.1 Accept: application/json
Response
HTTP/1.1 200 OK Content-Type: application/json { "id": 147, "identifier": "2014-09-03_10-58-59_4_4ee02475335911e4a935c86000cbf5fb.csv", "created_on": "2014-09-03T10:58:59.754880", "agent_id": "836ce137-6ad4-443f-abb9-94c4465ff87c" }
Statuscode 200: no error Statuscode 404: task or logfile not found -
-
methods
= ['GET', 'POST']¶
-
post
(job_id, task_id, attempt, log_identifier)[source]¶ A
POST
to this endpoint will update metadata about the specified logfile-
POST
/api/v1/jobs/<job_id>/tasks/<task_id>/attempts/<attempt>/logs/<log_identifier> HTTP/1.1
¶ Request
POST /api/v1/jobs/4/tasks/1300/attempts/5/logs/2014-09-03_10-58-59_4_4ee02475335911e4a935c86000cbf5fb.csv HTTP/1.1 Accept: application/json Content-Type: application/json { "state": "done" }
Response
HTTP/1.1 200 OK Content-Type: application/json { "id": 147, "identifier": "2014-09-03_10-58-59_4_4ee02475335911e4a935c86000cbf5fb.csv", "created_on": "2014-09-03T10:58:59.754880", "agent_id": "836ce137-6ad4-443f-abb9-94c4465ff87c" }
Statuscode 200: no error Statuscode 404: task or logfile not found -
-
-
class
pyfarm.master.api.tasklogs.
TaskLogfileAPI
[source]¶ Bases:
flask.views.MethodView
-
get
(job_id, task_id, attempt, log_identifier)[source]¶ A
GET
to this endpoint will return the actual logfile or a redirect to it.-
GET
/api/v1/jobs/<job_id>/tasks/<task_id>/attempts/<attempt>/logs/<log_identifier>/logfile HTTP/1.1
¶ Request
GET /api/v1/jobs/4/tasks/1300/attempts/5/logs/2014-09-03_10-58-59_4_4ee02475335911e4a935c86000cbf5fb.csv/logfile HTTP/1.1 Accept: text/csv
Response
HTTP/1.1 200 OK Content-Type: text/csv <Content of the logfile>
Statuscode 200: no error Statuscode 307: The logfile can be found in another location at this point in time. Independent future requests for the same logfile should continue using the original URL Statuscode 400: the specified logfile identifier is not acceptable Statuscode 404: task or logfile not found -
-
methods
= ['GET', 'PUT']¶
-
put
(job_id, task_id, attempt, log_identifier)[source]¶ A
PUT
to this endpoint will upload the request’s body as the specified logfile-
PUT
/api/v1/jobs/<job_id>/tasks/<task_id>/attempts/<attempt>/logs/<log_identifier>/logfile HTTP/1.1
¶ Request
PUT /api/v1/jobs/4/tasks/1300/attempts/5/logs/2014-09-03_10-58-59_4_4ee02475335911e4a935c86000cbf5fb.csv/logfile HTTP/1.1 <content of the logfile>
Response
HTTP/1.1 201 CREATED
Statuscode 201: lofile was uploaded Statuscode 400: the specified logfile identifier is not acceptable Statuscode 404: task or logfile not found -
-