RunCommandLogs: add helpers for if it is running/failed/signaled

[?]
Nov 19, 2021, 6:21 PM
52IH5FN37NTRYXWISGUIT2CVJ52YBUSNRDPXMS3IIS3JOODQ523QC

Dependencies

  • [2] RZBW3YWD RunCommandLogs: add a did_succeed helper
  • [3] FFJI7K6E RunCommandLogs: test recording a signaled process without a core dump
  • [4] VYS5RV7Y RunCommand: create run logs for each execution
  • [*] 2GNJU4VF RunCommandLogs: init table

Change contents

  • edit in src/lib/Hydra/Schema/Result/RunCommandLogs.pm at line 259
    [2.385]
    [2.385]
    =head2 is_running
  • edit in src/lib/Hydra/Schema/Result/RunCommandLogs.pm at line 263
    [2.386]
    [6.2945]
    Looks in the database to see if the task has been marked as completed.
    Does not actually examine to see if the process is running anywhere.
    Return:
    * true if the task does not have a marked end date
    * false if the task does have a recorded end
    =cut
    sub is_running {
    my ($self) = @_;
    return !defined($self->end_time);
    }
    =head2 did_fail_with_signal
    Looks in the database to see if the task failed with a signal.
    Return:
    * true if the task is not running and failed with a signal.
    * false if the task is running or exited with an exit code.
    =cut
    sub did_fail_with_signal {
    my ($self) = @_;
    if ($self->is_running()) {
    return 0;
    }
    if ($self->did_succeed()) {
    return 0;
    }
    return defined($self->signal);
    }
  • edit in t/Schema/Result/RunCommandLogs.t at line 57
    [2.464]
    [4.3884]
    ok($runlog->is_running(), "The process is running.");
    ok(!$runlog->did_fail_with_signal(), "The process was not killed by a signal.");
  • edit in t/Schema/Result/RunCommandLogs.t at line 71
    [2.525]
    [4.4390]
    ok(!$runlog->is_running(), "The process is not running.");
    ok(!$runlog->did_fail_with_signal(), "The process was not killed by a signal.");
  • edit in t/Schema/Result/RunCommandLogs.t at line 86
    [2.591]
    [4.4965]
    ok(!$runlog->is_running(), "The process is not running.");
    ok(!$runlog->did_fail_with_signal(), "The process was not killed by a signal.");
  • edit in t/Schema/Result/RunCommandLogs.t at line 101
    [3.586]
    [3.586]
    ok(!$runlog->is_running(), "The process is not running.");
    ok($runlog->did_fail_with_signal(), "The process was killed by a signal.");
  • replacement in t/Schema/Result/RunCommandLogs.t at line 108
    [3.933][3.933:993]()
    is($runlog->core_dumped, 1, "There was no core dump.");
    [3.933]
    [3.993]
    is($runlog->core_dumped, 0, "There was no core dump.");
  • edit in t/Schema/Result/RunCommandLogs.t at line 116
    [2.657]
    [4.5541]
    ok(!$runlog->is_running(), "The process is not running.");
    ok($runlog->did_fail_with_signal(), "The process was killed by a signal.");
  • edit in t/Schema/Result/RunCommandLogs.t at line 131
    [2.723]
    [4.6092]
    ok(!$runlog->is_running(), "The process is running.");
    ok(!$runlog->did_fail_with_signal(), "The process was not killed by a signal.");