def retrieve_model_entities(): team_uuid = team_info.retrieve_team_uuid(flask.session, flask.request) model_entities = model_trainer.retrieve_model_list(team_uuid) team_entity = storage.retrieve_team_entity(team_uuid) sanitize(model_entities) response = { 'total_training_minutes': team_info.TOTAL_TRAINING_MINUTES_PER_TEAM, 'remaining_training_minutes': team_entity['remaining_training_minutes'], 'model_entities': model_entities, } return flask.jsonify(response)
def retrieve_model_entity(): team_uuid = team_info.retrieve_team_uuid(flask.session, flask.request) data = flask.request.form.to_dict(flat=True) model_uuid = data.get('model_uuid') model_entity = model_trainer.retrieve_model_entity(team_uuid, model_uuid) team_entity = storage.retrieve_team_entity(team_uuid) sanitize(model_entity) response = { 'remaining_training_minutes': team_entity['remaining_training_minutes'], 'model_entity': model_entity, } return flask.jsonify(response)
def start_training_model(): team_uuid = team_info.retrieve_team_uuid(flask.session, flask.request) data = flask.request.form.to_dict(flat=True) description = data.get('description') dataset_uuids_json = data.get('dataset_uuids') starting_model = data.get('starting_model') max_running_minutes = int(data.get('max_running_minutes')) num_training_steps = int(data.get('num_training_steps')) create_time_ms = int(data.get('create_time_ms')) model_entity = model_trainer.start_training_model(team_uuid, description, dataset_uuids_json, starting_model, max_running_minutes, num_training_steps, create_time_ms) action_parameters = model_trainer.make_action_parameters(team_uuid, model_entity['model_uuid']) action.trigger_action_via_blob(action_parameters) team_entity = storage.retrieve_team_entity(team_uuid) sanitize(model_entity) response = { 'remaining_training_minutes': team_entity['remaining_training_minutes'], 'model_entity': model_entity, } return flask.jsonify(response)