JSONRPC Calls

Functions to communicate with the server using JSONRPC

class iceprod.core.exe_json.ServerComms(url, passkey, config, **kwargs)[source]

Setup JSONRPC communications with the IceProd server.

Parameters:
  • url (str) – address to connect to

  • passkey (str) – passkey for authorization/authentication

  • config (iceprod.server.exe.Config) – Config object

  • **kwargs – passed to JSONRPC

async download_task(gridspec, resources={}, site='', query_params=None)[source]

Download new task(s) from the server.

Parameters:
  • gridspec (str) – gridspec the pilot was submitted from

  • resources (dict) – resources available in the pilot

  • site (str) – site where pilot is running

Returns:

list of task configs

Return type:

list

async task_files(dataset_id, task_id)[source]

Get the task files for a dataset and task.

Parameters:
  • dataset_id (str) – dataset_id

  • task_id (str) – task_id

Returns:

list of iceprod.core.dataclasses.Data objects

Return type:

list

async processing(task_id)[source]

Tell the server that we are processing this task.

Only used for single task config, not for pilots.

Parameters:

task_id (str) – task_id to mark as processing

async finish_task(task_id, dataset_id=None, stats={}, stat_filter=None, start_time=None, resources=None, site=None)[source]

Finish a task.

Parameters:
  • task_id (str) – task_id of task

  • dataset_id (str) – (optional) dataset_id of task

  • stats (dict) – (optional) task statistics

  • stat_filter (iterable) – (optional) stat filter by keywords

  • start_time (float) – (optional) task start time in unix seconds

  • resources (dict) – (optional) task resource usage

  • site (str) – (optional) site the task is running at

async still_running(task_id)[source]

Check if the task should still be running according to the DB.

Parameters:

task_id (str) – task_id of task

async task_error(task_id, dataset_id=None, stats={}, start_time=None, reason=None, resources=None, site=None, failed=False)[source]

Tell the server about the error experienced

Parameters:
  • task_id (str) – task_id of task

  • dataset_id (str) – (optional) dataset_id of task

  • stats (dict) – (optional) task statistics

  • start_time (float) – (optional) task start time in unix seconds

  • reason (str) – (optional) one-line summary of error

  • resources (dict) – (optional) task resource usage

  • site (str) – (optional) site the task is running at

  • failed (bool) – (optional) instead of resetting the task, just fail

async task_kill(task_id, dataset_id=None, resources=None, reason=None, message=None, site=None)[source]

Tell the server that we killed a task.

Parameters:
  • task_id (str) – task_id of task

  • dataset_id (str) – (optional) dataset_id of task

  • resources (dict) – (optional) used resources

  • reason (str) – (optional) short summary for kill

  • message (str) – (optional) long message to replace log upload

  • site (str) – (optional) site the task is running at

async uploadLog(**kwargs)[source]

Upload log file

async uploadErr(filename=None, **kwargs)[source]

Upload stderr file

async uploadOut(filename=None, **kwargs)[source]

Upload stdout file

async create_pilot(**kwargs)[source]

Create an entry in the pilot table.

Parameters:

**kwargs – passed through to rest function

Returns:

pilot id

Return type:

str

async update_pilot(pilot_id, **kwargs)[source]

Update the pilot table.

Parameters:
  • pilot_id (str) – pilot id

  • **kwargs – passed through to rest function

async delete_pilot(pilot_id, **kwargs)[source]

Delete the pilot.

Parameters:

pilot_id (str) – pilot id

task_kill_sync(task_id, dataset_id=None, resources=None, reason=None, message=None, site=None)[source]

Tell the server that we killed a task (synchronous version).

Parameters:
  • task_id (str) – task_id of task

  • dataset_id (str) – (optional) dataset_id of task

  • resources (dict) – (optional) used resources

  • reason (str) – (optional) short summary for kill

  • message (str) – (optional) long message to replace log upload

  • site (str) – (optional) site the task is running at

update_pilot_sync(pilot_id, **kwargs)[source]

Update the pilot table (synchronous version).

Parameters:
  • pilot_id (str) – pilot id

  • **kwargs – passed through to rpc function

delete_pilot_sync(pilot_id, **kwargs)[source]

Delete the pilot (synchronous version).

Parameters:

pilot_id (str) – pilot id