Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apeman-model-client-0.2.7.5.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

apeman_model_client-0.2.7.5-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file apeman-model-client-0.2.7.5.tar.gz.

File metadata

  • Download URL: apeman-model-client-0.2.7.5.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for apeman-model-client-0.2.7.5.tar.gz
Algorithm Hash digest
SHA256 d7ada8d7e8266ab1486f632a84b02d987deda92745e85ddaa940062b74120340
MD5 b1634102498d51c742a0a2c90b25bf02
BLAKE2b-256 b243b70f457723bcf4609d013d5491bc169f5681317f6ced682ac9ae291a591b

See more details on using hashes here.

File details

Details for the file apeman_model_client-0.2.7.5-py3-none-any.whl.

File metadata

File hashes

Hashes for apeman_model_client-0.2.7.5-py3-none-any.whl
Algorithm Hash digest
SHA256 88f229e4f5b25365253c3f9052f2699c6ac02057e675f50021b5a2809944544c
MD5 dc8aa9f2ff1d88813ef7e8d27460bded
BLAKE2b-256 abc9e12c3eaad3f50524baa126be71c5b788c0cb5307d5dde1c53c72865e12f9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page