Exemple #1
0
            "mlflow.user": "******"
        }
        run.set_tags(tags)
        job_info_dict = {
            "run_id": run._run_id,
            "experiment_name": exp.name,
            "experiment_id": exp._id
        }
        json_dict = json.dumps(job_info_dict)
        with open(job_info_path, "w") as f:
            f.write(json_dict)
            f.close()
        # log environment variables
        env_dictionary["MLFLOW_EXPERIMENT_ID"] = exp._id
        env_dictionary["MLFLOW_RUN_ID"] = run._run_id
        env_dictionary["MLFLOW_TRACKING_URI"] = _get_mlflow_tracking_uri(ws)
        env_dictionary["HOME"] = "~/"

    print("Before running train")
    try:
        print("Trying to run train file ")
        ret, _ = run_command([sys.executable] + sys.argv[3:],
                             env=env_dictionary)
    except subprocess.CalledProcessError as e:
        print("Subprocess caused error " + run_name)
        better_e = RuntimeError("{}\n{}".format(e.stderr, e))
        run.fail(error_details=better_e)
        raise better_e
    else:
        run.complete()
        print("Marked as complete")
Exemple #2
0
# モデルの評価
import os, json
from azureml.core import Workspace
from azureml.core import Experiment
from azureml.core.model import Model
import azureml.core
from azureml.core import Run

run_id = ""  # failするrun id を記載

# Workspaceの取得
ws = Workspace.from_config()

# 最新のrun, Experimentの取得
with open("aml_config/run_id.json") as f:
    config = json.load(f)
new_model_run_id = config["run_id"]
experiment_name = config["experiment_name"]
exp = Experiment(workspace=ws, name=experiment_name)

fail_run = Run(exp, run_id=run_id)

fail_run.fail()