def get_trainingjobs():
LOGGER.debug(f'get the trainingjobs')
try:
- resp = get_trainining_jobs()
+ resp = trainingjob_schema.dump(get_trainining_jobs())
return jsonify(resp), 200
except TMException as err:
return jsonify({
def get_trainingjob(training_job_id):
LOGGER.debug(f'get the trainingjob correspoinding to id: {training_job_id}')
try:
- return jsonify(get_training_job(training_job_id)), 200
+ return jsonify(trainingjob_schema.dump(get_training_job(training_job_id))), 200
except TMException as err:
return jsonify({
'message': str(err)
return jsonify(json.loads(status)), 200
except Exception as err:
return jsonify({
- 'message': str(e)
+ 'message': str(err)
}), 500
\ No newline at end of file
except NoResultFound:
return None
except Exception as e:
- raise DBException(f'{DB_QUERY_EXEC_ERROR} in the get_trainingjob_by_modelId_db : {str(e)}')
\ No newline at end of file
+ raise DBException(f'{DB_QUERY_EXEC_ERROR} in the get_trainingjob_by_modelId_db : {str(e)}')
+
+def change_steps_state(trainingjob, step: Steps, state:States):
+ try:
+ steps_state = json.loads(trainingjob.steps_state.states)
+ steps_state[step] = state
+ trainingjob.steps_state.states=json.dumps(steps_state)
+ db.session.add(trainingjob)
+ db.session.commit()
+ except Exception as e:
+ raise DBException(f'{DB_QUERY_EXEC_ERROR} in the change_steps_state : {str(e)}')
\ No newline at end of file
def get_training_job(training_job_id: int):
try:
tj =get_trainingjob(training_job_id)
- return trainingJobSchema.dump(tj)
+ return tj
except DBException as err:
raise TMException(f"get_training_job by id failed with exception : {str(err)}")
def get_trainining_jobs():
try:
tjs = get_trainingjob()
- result = trainingJobsSchema.dump(tjs)
- return result
+ return tjs
except DBException as err:
raise TMException(f"get_training_jobs failed with exception : {str(err)}")