Ejemplo n.º 1
0
def log_param(key, value, worker_index):
    """
    Log a parameter under the current run, creating a run if necessary.
    :param key: Parameter name (string)
    :param value: Parameter value (string, but will be string-field if not)
    :param worker_index
    """
    job_name = get_job_name()
    SubmarineClient().log_param(job_name, key, value, worker_index)
Ejemplo n.º 2
0
def log_metric(key, value, worker_index, step=None):
    """
    Log a metric under the current run, creating a run if necessary.
    :param key: Metric name (string).
    :param value: Metric value (float). Note that some special values such as +/- Infinity may be
                  replaced by other values depending on the store. For example, sFor example, the
                  SQLAlchemy store replaces +/- Inf with max / min float values.
    :param worker_index: Metric worker_index (string).
    :param step: Metric step (int). Defaults to zero if unspecified.
    """
    job_name = get_job_name()
    SubmarineClient().log_metric(job_name, key, value, worker_index,
                                 int(time.time() * 1000), step or 0)
Ejemplo n.º 3
0
def test_get_job_name():
    env = {
        _JOB_NAME_ENV_VAR: "application_12346789",
    }
    with mock.patch.dict(os.environ, env):
        assert get_job_name() == "application_12346789"