Я написал свой код, и он имеет следующую форму
def train(run_name, log_basepath, logger, parameters):
try:
metrics = training_functions(parameters) # <---- code that can fail
# demo for up loading attributes to a given run
with mlflow.start_run(run_name=run_name):
# log parameters
mlflow.log_params(parameters)
# log metrics
mlflow.log_metrics(metrics)
# define experiment tags
mlflow.set_tags(tags)
# upload pertinent files
mlflow.log_artifact(artifact_abspath)
# main model files
mlflow.log_artifact(log_basepath)
except Exception as e:
logger.error('\nFailed model training. Returned following error:\n {} \n\n'.format(e))
logger.info( 'Error on line {}'.format(sys.exc_info()[-1].tb_lineno))
# demo for up loading attributes to a given run
with mlflow.start_run(run_name=run_name):
# define run tags
logger.info('experiment name: {}'.format(experiment_name))
logger.info('run_name: {}'.format(run_name))
logger.info('run failed')
mlflow.log_artifact(log_basepath)
Моя цель - отправлять журналы на сервер mlflow в случае сбоя. Мои вопросы: как мне заставить mlflow пометить это как сбой?