-
Notifications
You must be signed in to change notification settings - Fork 16
SinaAuto Api Documents
Parameters:
- Auth:
- 'user_id'
- File:
- 'dataset': string
- Form:
- name: string
- task: string
Response:
- JSON
- 'id': string
- 'name': string
- 'task': string
- 'size_bytes': string
Auth:
Parameters:
- Auth:
- 'user_id'
Response:
- JSON
- array:
- 'id': dataset.id,
- 'name': dataset.name,
- 'task': dataset.task,
- 'datetime_created': dataset.datetime_created,
- 'size_bytes': dataset.size_bytes,
- 'store_dataset_id':
- 'stat'
- array:
Parameters:
- Auth:
- user_id
- Form:
- name: string
- task: string
- model_file_bytes: file
- model_class: string
- checkpoint_id:string
- docker_image=none
- dependencies={}
- access_right=ModelAccessRight.PRIVATE
Response:
- 'id': model.id,
- 'user_id': model.user_id,
- 'name': model.name
Parameters:
- Auth:
- user_id
- Form:
- model_id
Responses:
- 'id': model.id,
- 'user_id': model.user_id,
- 'name': model.name
Parameters:
- Auth:
- user_id
Responses:
- 'id': model.id,
- 'user_id': model.user_id,
- 'name': model.name,
- 'task': model.task,
- 'model_class': model.model_class,
- 'datetime_created': model.datetime_created,
- 'docker_image': model.docker_image,
- 'dependencies': model.dependencies,
- 'access_right': model.access_right
Parameters:
- Auth:
- user_id
- Query param:
- task=None
Responses:
- array:
- 'id': model.id,
- 'user_id': model.user_id,
- 'name': model.name,
- 'task': model.task,
- 'datetime_created': model.datetime_created,
- 'dependencies': model.dependencies,
- 'access_right': model.access_right
Parameters:
- Auth
- user_id
- Form:
- dataset_id
Response:
- JSON
- array
- 'id': model.id,
- 'user_id': model.user_id,
- 'name': model.name,
- 'task': model.task,
- 'datetime_created': model.datetime_created,
- 'dependencies': model.dependencies,
- 'access_right': model.access_right
- array
# from admin.py
def create_train_job(
self, user_id, app, task,
train_dataset_id, val_dataset_id,
budget, model_ids, train_args={}):
"""
Creates and starts a train job on Rafiki.
A train job is uniquely identified by user, its associated app, and the app version (returned in output).
Only admins, model developers & app developers can manage train jobs. Model developers & app developers can only manage their own train jobs.
:param app: Name of the app associated with the train job
:param task: Task associated with the train job,
the train job will train models associated with the task
:param train_dataset_id: ID of the train dataset, previously created on Rafiki
:param val_dataset_id: ID of the validation dataset, previously created on Rafiki
:param budget: Budget for train job
The following describes the budget options available:
===================== =====================
**Budget Option** **Description**
--------------------- ---------------------
``TIME_HOURS`` Max no. of hours to train (soft target). Defaults to 0.1.
``GPU_COUNT`` No. of GPUs to allocate for training, across all models. Defaults to 0.
``MODEL_TRIAL_COUNT`` Max no. of trials to conduct for each model (soft target). -1 for unlimited. Defaults to -1.
===================== =====================
``budget`` should be a dictionary of ``{ <budget_type>: <budget_amount> }``, where
``<budget_type>`` is one of :class:`rafiki.constants.BudgetOption` and
``<budget_amount>`` specifies the amount for the associated budget option.
:param model_ids: List of IDs of model to use for train job.
NOTE: only client.py defaults to all models if model_ids is None!
:param train_args: Additional arguments to pass to models during training, if any.
Refer to the task's specification for appropriate arguments
:returns: Created train job as dictionary
"""
Parameters:
- Auth
- user_id
- Form
- app,
- task,
- train_dataset_id,
- val_dataset_id,
- budget: string {},
- model_ids: list in string quotation or list,
- train_args={}
Responses:
- 'id': train_job.id,
- 'app': train_job.app,
- 'app_version': train_job.app_version
get /train_jobs is calling get_train_jobs_by_user
# from admin.py
def get_train_jobs_by_user(self, user_id):
"""
unlike get_train_jobs_by_app,
get_train_jobs_by_user is called by:
@app.route('/train_jobs', methods=['GET'])
"""
Parameters:
before Feb2020, /train_jobs expects user_id
as a query-param
- Auth:
- user_id
Responses:
- JSON:
- array:
- 'id': x.id,
- 'status': x.status,
- 'app': x.app,
- 'app_version': x.app_version,
- 'task': x.task,
- 'train_dataset_id': x.train_dataset_id,
- 'val_dataset_id': x.val_dataset_id,
- 'train_args': x.train_args,
- 'datetime_started': x.datetime_started,
- 'datetime_stopped': x.datetime_stopped,
- 'budget': x.budget
- array:
# from admin.py
def get_train_jobs_by_app(self, user_id, app):
"""
unlike get_train_jobs_by_user,
get_train_jobs_by_app is for:
GET /train_jobs/{app}
"""
Parameters:
- Auth:
- user_id
Responses:
- JSON:
- array:
- 'id': x.id,
- 'status': x.status,
- 'app': x.app,
- 'app_version': x.app_version,
- 'task': x.task,
- 'train_dataset_id': x.train_dataset_id,
- 'val_dataset_id': x.val_dataset_id,
- 'train_args': x.train_args,
- 'datetime_started': x.datetime_started,
- 'datetime_stopped': x.datetime_stopped,
- 'budget': x.budget
- array:
# from admin.py
def get_train_job(self, user_id, app, app_version=-1): # by app ver
"""
get_train_job() is called by:
@app.route('/train_jobs/<app>/<app_version>',
methods=['GET'])
"""
Parameters:
- Auth:
- user_id
Responses:
- JSON
- 'id': train_job.id,
- 'status': train_job.status,
- 'app': train_job.app,
- 'app_version': train_job.app_version,
- 'task': train_job.task,
- 'train_dataset_id': train_job.train_dataset_id,
- 'val_dataset_id': train_job.val_dataset_id,
- 'train_args': train_job.train_args,
- 'datetime_started': train_job.datetime_started,
- 'datetime_stopped': train_job.datetime_stopped
stop_train_job
Parameters:
- Auth:
- user_id
- File:
- Form:
Responses:
- 'id': train_job.id,
- 'app': train_job.app,
- 'app_version': train_job.app_version
get_trials_of_train_job
Paramters:
- Auth:
- user_id
- File:
- Form:
- max_count
- InPath:
- app
- app_version
Responses:
- 'id': trial.id,
- 'proposal': trial.proposal,
- 'datetime_started': trial.datetime_started,
- 'status': trial.status,
- 'datetime_stopped': trial.datetime_stopped,
- 'model_name': model.name,
- 'score': trial.score,
- 'is_params_saved': trial.is_params_saved
get_trial
Paramters:
- Auth:
- File:
- Form:
- InPath:
- trial_id
Responses:
- 'id': trial.id,
- 'no': trial.no,
- 'worker_id': trial.worker_id,
- 'proposal': trial.proposal,
- 'datetime_started': trial.datetime_started,
- 'status': trial.status,
- 'datetime_stopped': trial.datetime_stopped,
- 'model_name': model.name,
- 'score': trial.score,
- 'is_params_saved': trial.is_params_saved
get_trial_logs
Paramters:
- Auth:
- File:
- Form:
- InPath:
- trial_id
Responses:
- 'plots': plots,
- 'metrics': metrics,
- 'messages': messages
get_trial_parameters
Paramters:
- Auth:
- File:
- Form:
- InPath:
- trial_id
Responses:
- application/octet-stream (pickle dump)
create_inference_job
Paramters:
- Auth:
- user_id
- File:
- Form:
- app
- app_version
- budget
- InPath:
Responses:
- 'id': inference_job.id,
- 'train_job_id': train_job.id,
- 'app': train_job.app,
- 'app_version': train_job.app_version,
- 'predictor_host': predictor_service.host
get_inference_jobs_by_user
Paramters:
- Auth:
- user_id
- user_type
- File:
- Form:
- InPath:
Responses:
- JSON:
- array
- 'id': inference_job.id,
- 'status': inference_job.status,
- 'train_job_id': train_job.id,
- 'app': train_job.app,
- 'app_version': train_job.app_version,
- 'datetime_started': inference_job.datetime_started,
- 'datetime_stopped': inference_job.datetime_stopped
- array
get_inference_jobs_of_app
Paramters:
- Auth:
- user_id
- File:
- Form:
- InPath:
- app
Responses:
- JSON:
- array
- 'id': inference_job.id,
- 'status': inference_job.status,
- 'train_job_id': train_job.id,
- 'app': train_job.app,
- 'app_version': train_job.app_version,
- 'datetime_started': inference_job.datetime_started,
- 'datetime_stopped': inference_job.datetime_stopped
- array
get_running_inference_jobs
Paramters:
- Auth:
- user_id
- File:
- Form:
- InPath:
- app
- app_version
Responses:
- 'id': inference_job.id,
- 'status': inference_job.status,
- 'train_job_id': train_job.id,
- 'app': train_job.app,
- 'app_version': train_job.app_version,
- 'datetime_started': inference_job.datetime_started,
- 'datetime_stopped': inference_job.datetime_stopped,
- 'predictor_host': predictor_service.host if predictor_service is not None else None
stop_inference_job
Paramters:
- Auth:
- user_id
- File:
- Form:
- InPath:
- app
- app_version
Responses:
- 'id': inference_job.id,
- 'train_job_id': train_job.id,
- 'app': train_job.app,
- 'app_version': train_job.app_version
create_inference_job_by_checkpoint
Paramters:
- Auth:
- user_id
- File:
- Form:
- model_name
- budget
- InPath:
Responses:
- 'id': inference_job.id,
- 'train_job_id': train_job.id,
- 'app': train_job.app,
- 'app_version': train_job.app_version,
- 'predictor_host': predictor_service.host