REST API - Logs

iceprod.rest.handlers.logs.setup(handler_cfg)[source]

Setup method for Logs REST API.

Parameters:

handler_cfg (dict) – args to pass to the route

Returns:

routes, database, indexes

Return type:

dict

class iceprod.rest.handlers.logs.MultiLogsHandler(*args, **kwargs)[source]

Handle logs requests.

async get()[source]

Get multiple log entries based on search arguments.

Body args (json):

from (str): timestamp to start searching to (str): timestamp to end searching name (str): name (type) of log dataset_id (str): dataset_id task_id (str): task_id keys: | separated list of keys to return for each task

Returns:

{log_id: {keys}}

Return type:

dict

async post()[source]

Create a log entry.

Body should contain the following fields:

data: str

Optional fields:

dataset_id: str task_id: str name: str

Returns:

{‘result’: <log_id>}

Return type:

dict

class iceprod.rest.handlers.logs.LogsHandler(*args, **kwargs)[source]

Handle logs requests.

async get(log_id)[source]

Get a log entry.

Parameters:

log_id (str) – the log id of the entry

Returns:

all body fields

Return type:

dict

async delete(log_id)[source]

Delete a log entry.

Parameters:

log_id (str) – the log id of the entry

Returns:

empty dict on success

Return type:

dict

class iceprod.rest.handlers.logs.DatasetMultiLogsHandler(*args, **kwargs)[source]

Handle logs requests.

async post(dataset_id)[source]

Create a log entry.

Body should contain the following fields:

data: str

Optional fields:

task_id: str name: str

Parameters:

dataset_id (str) – the dataset id

Returns:

{‘result’: <log_id>}

Return type:

dict

async delete(dataset_id, task_id)[source]

Delete all logs for a dataset.

Streams progress as deletion happens.

Parameters:
  • dataset_id (str) – the dataset id

  • task_id (str) – the task id

Returns:

one json doc per line, {‘status’, ‘percent_complete’}

Return type:

str

class iceprod.rest.handlers.logs.DatasetLogsHandler(*args, **kwargs)[source]

Handle logs requests.

async get(dataset_id, log_id)[source]

Get a log.

Parameters:
  • dataset_id (str) – the dataset id

  • log_id (str) – the log id of the entry

Returns:

all body fields

Return type:

dict

class iceprod.rest.handlers.logs.DatasetTaskLogsHandler(*args, **kwargs)[source]

Handle log requests for a task

async get(dataset_id, task_id)[source]

Get logs for a dataset and task.

Note: “num” and “group” are generally not used together.

Params (optional):

num (int): number of logs, or groups of logs, to return group {true, false}: group by log name order {asc, desc}: order by time keys: | separated list of keys to return for each log

Parameters:
  • dataset_id (str) – the dataset id

  • task_id (str) – the task id

Returns:

{‘logs’: [log entry dict, log entry dict]}

Return type:

dict

async delete(dataset_id, task_id)[source]

Delete all logs for a dataset and task.

Parameters:
  • dataset_id (str) – the dataset id

  • task_id (str) – the task id

Returns:

empty dict on success

Return type:

dict