Client

You may access PlatIAgro Projects API using the following functions.

Experiments

platiagro.client.list_experiments(project_id: str)

Lists all experiments.

Parameters

project_id (str) – the project uuid.

Returns

list of experiments.

Return type

requests.Response

from platiagro.client import list_experiments

project_id = 'c862813f-13e8-4adb-a430-56a1444209a0'

list_experiments(project_id)
{'experiments': [{'uuid': 'a8ab15b1-7a90-4f18-b18d-e14f7422c938', 'name': 'foo', 'project_id': 'c862813f-13e8-4adb-a430-56a1444209a0'}]}
platiagro.client.get_experiment_by_name(project_id: str, experiment_name: str)

Gets the experiment by name.

Parameters
  • project_id (str) – the project uuid.

  • experiment_name (str) – the experiment name.

Returns

the experiment corresponding to the given name.

Return type

dict

Raises

ValueError – if the given experiment name doesn’t exist.

from platiagro.client import get_experiment_by_name

project_id = 'c862813f-13e8-4adb-a430-56a1444209a0'
experiment_name = 'foo'

get_experiment_by_name(project_id, experiment_name)
{'uuid': 'a8ab15b1-7a90-4f18-b18d-e14f7422c938', 'name': 'foo', 'project_id': 'c862813f-13e8-4adb-a430-56a1444209a0'}
platiagro.client.run_experiment(project_name: str, experiment_name: str)

Run the given experiment.

Parameters
  • project_name (str) – the project name.

  • experiment_name (str) – the experiment name.

Returns

the details of experiment.

Return type

requests.Response

from platiagro.client import run_experiment

project_name = 'foo'
experiment_name = 'bar'

run_experiment(experiment_name, project_name)
{'uuid': 'bc4a0874-4a6b-4e20-bd7e-ed00c51fd8ea', 'createdAt': '2021-05-24T13:57:20.767Z', 'operators': []}

Deployments

platiagro.client.list_deployments(project_id: str)

Lists all deployments.

Parameters

project_id (str) – the project uuid.

Returns

list of deployments.

Return type

requests.Response

from platiagro.client import list_deployments

project_id = 'c862813f-13e8-4adb-a430-56a1444209a0'

list_deployments(project_id)
{'deployments': [{'uuid': 'ea5661ab-28fe-4531-b310-8a37bd77197b', 'name': 'foo', 'project_id': 'c862813f-13e8-4adb-a430-56a1444209a0'}]}
platiagro.client.get_deployment_by_name(project_id: str, deployment_name: str)

Gets the deployment by name.

Parameters
  • project_id (str) – the project uuid.

  • deployment_name (str) – the deployment name.

Returns

the deployment corresponding to the given name.

Return type

dict

Raises

ValueError – if the given deployment name doesn’t exist.

from platiagro.client import get_deployment_by_name

project_id = 'c862813f-13e8-4adb-a430-56a1444209a0'
deployment_name = 'foo'

get_deployment_by_name(project_id, deployment_name)
{'uuid': 'ea5661ab-28fe-4531-b310-8a37bd77197b', 'name': 'foo', 'project_id': 'c862813f-13e8-4adb-a430-56a1444209a0'}
platiagro.client.run_deployment(project_name: str, deployment_name: str)

Runs the given deployement.

Parameters
  • project_name (str) – the project name.

  • deployment_name (str) – the deployment name.

Returns

the details of deployment.

Return type

requests.Response

from platiagro.client import run_deployment

project_name = 'foo'
deployment_name = 'bar'

run_deployment(deployment_name, project_name)
{'uuid': 'b793c517-2f95-41f0-a4bb-25da50d6e052', 'createdAt': '2021-05-24T13:57:20.767Z', 'operators': []}

Projects

platiagro.client.list_projects()

Lists all projects.

Returns

list of projects.

Return type

requests.Response

from platiagro.client import list_projects

list_projects()
{'projects': [{'uuid': 'c862813f-13e8-4adb-a430-56a1444209a0', 'name': 'foo'}]}
platiagro.client.get_project_by_name(project_name: str)

Gets the project by name.

Parameters

project_name (str) – the project name.

Returns

the project corresponding to the given project name.

Return type

dict

Raises

ValueError – if the given project name doesn’t exist.

from from platiagro.client import get_project_by_name

project_name = 'foo'
get_project_by_name(project_name)
{'uuid': 'c862813f-13e8-4adb-a430-56a1444209a0', 'name': 'foo'}

Tasks

platiagro.client.create_task(name, **kwargs)

API to create tasks.

Parameters
  • name (str) – the task name.

  • **kwargs – Arbitrary keyword arguments.

Returns

the response returned by PlatIAgro Projects API.

Return type

requests.Response

from platiagro.client import create_task

create_task(name = "foo")
{'uuid': '3fa85f64-5717-4562-b3fc-2c963f66afa6', 'name': 'foo', 'createdAt': '2021-05-24T14:04:44.126Z', 'updatedAt': '2021-05-24T14:04:44.126Z'}