Apeman model service client SDK
Project description
This library enables you to report the status of tasks in your model at runtime
publish:
python -m build
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
install: pip install apeman-model-client==0.1.8
How to use
export apeman_meta_server_addr='localhost:9090'
from apeman.model.openapi import apeman_open_api_client
from apeman.model.openapi.model_instance_task_status import TaskStatus
from apeman.model.openapi.model_instance_task_launch_type import TaskLaunchType
from apeman.model.openapi.model_instance_task_type import TaskType
endpoint = apeman_open_api_client.get_endpoint(model_instance_id='')
# cancel task
apeman_open_api_client.cancel_task(task_id='', force_delete=True, token='')
# report status
response = apeman_open_api_client.report_and_get_status(task_id='', status=TaskStatus.RUNNING, progress=0.1,
message='Task is running', token='')
if response.status == TaskStatus.CANCELED:
raise Exception('Task has been cancelled.')
# add instance task
apeman_open_api_client.add_model_instance_task(model_instance_id='', tenant_id='', task_token='', task_parameters='',
job_context='', start_time=1, end_time=2,
launch_type=TaskLaunchType.TASK_ADHOC, task_type=TaskType.TASK_TRAIN)
# get instance task
task = apeman_open_api_client.get_instance_task(model_instance_task_id='test', token='token')
print(task.taskProgress)
print(task.taskMessage)
print(task.taskStatus)
# add instance task
apeman_open_api_client.add_model_instance_task(model_instance_id='', tenant_id='', task_token='', task_parameters='',
job_context='', start_time=1, end_time=2,
launch_type=TaskLaunchType.TASK_ADHOC, task_type=TaskType.TASK_TRAIN)
task_id_list = ['1', '2', '3']
task_list_response = apeman_open_api_client.batch_get_model_instance_task(task_id_list=task_id_list)
print(task_list_response.model_instance_task_list)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for apeman-model-client-0.2.7.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4562baaf74b83758fd87cbeb2e07649e1eaf84ae5f0ca481ccf12061e4fd637 |
|
MD5 | 1e50c81f7ae4cd886fdeb376c1f45ade |
|
BLAKE2b-256 | 0e42655bbd7ae91117b6c578d04181be258c72514ccb9cd13c009ead0a9476a7 |
Close
Hashes for apeman_model_client-0.2.7.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ae8751787cda656f57e1e84bc219b9b12c071373ee16cd775b5b23614f63b7a |
|
MD5 | ac95f76d3e5a067f6fc3bdd256dce535 |
|
BLAKE2b-256 | 10910987ee0fc90522703c1f5b504fa72afd5765147c99d73bf817e28c5ddef0 |