Пример #1
0
def log_trial_run_error(e, trial_run):
    from guild import main

    msg, code = main.system_exit_params(e)
    if code == 0:
        if msg:
            log.info(msg)
        return False
    log.error(
        "Trial %s exited with an error%s",
        _trial_name(trial_run),
        _trial_run_error_desc(code, msg),
    )
    return True
Пример #2
0
    def _fix_system_exit_msg_for_remote(self, e, cmds):
        from guild import main

        assert isinstance(e, SystemExit), e
        msg, code = main.system_exit_params(e)
        if not msg:
            raise SystemExit(code)
        for cmd in cmds:
            maybe_changed = msg.replace(
                "guild %s" % self.name, "guild %s -r %s" % (self.name, cmd)
            )
            if maybe_changed != msg:
                msg = maybe_changed
                break
        raise SystemExit(msg, code)
Пример #3
0
def _notify_cmd_params(error):
    from guild import main

    summary = "guild check"
    body = "PASSED"
    urgency = "normal"
    if error:
        error_msg, code = main.system_exit_params(error)
        # SystemExit errors are used for 0 exit codes, which are not
        # actually errors.
        if code != 0:
            body = "FAILED (%s)" % code
            if error_msg:
                body += ": %s" % error_msg
                urgency = "critical"
    return summary, body, urgency
Пример #4
0
def handle_trial_system_exit(e, batch_run, trial_run):
    from guild import main

    msg, code = main.system_exit_params(e)
    if code == 0:
        if msg:
            log.info(msg)
    elif code == exit_code.SIGTERM:
        log.info("Trial %s was terminated", _trial_name(trial_run))
    elif code == exit_code.KEYBOARD_INTERRUPT:
        log.info("Stopping batch")
        raise SystemExit(code)
    else:
        log.error(
            "Trial %s exited with an error%s",
            _trial_name(trial_run),
            _trial_run_error_desc(code, msg),
        )
        if fail_on_trial_error(batch_run):
            log.error("Stopping batch because a trial failed (pending trials "
                      "can be started as needed)")
            raise SystemExit(code)