diff --git a/src/fmu/ensemble/realization.py b/src/fmu/ensemble/realization.py index dbc6fa89..2628e343 100644 --- a/src/fmu/ensemble/realization.py +++ b/src/fmu/ensemble/realization.py @@ -571,6 +571,10 @@ def load_status(self): # We get where if STARTIME.split(':') does not contain # integers only: durations.append(np.nan) + except IndexError: + # We get here if a clock time string is invalid, like missing seconds. + print("got indexerror") + durations.append(np.nan) status["DURATION"] = durations # Augment data from jobs.json if that file is available: diff --git a/tests/test_realization.py b/tests/test_realization.py index 07417767..a82eca0b 100644 --- a/tests/test_realization.py +++ b/tests/test_realization.py @@ -253,6 +253,24 @@ def test_status_load(tmpdir): assert "FORWARD_MODEL" in status assert np.isnan(status["DURATION"].values[0]) # Unsupported time syntax + with open(str(tmpdir.join("realization-0/STATUS")), "w") as status_fh: + status_fh.write("first line always ignored\n") + status_fh.write("INCLUDE_PC : 12:40 .... 12:40:55 \n") + real = ensemble.ScratchRealization(str(tmpdir.join("realization-0"))) + status = real.get_df("STATUS") + assert len(status) == 1 + assert "FORWARD_MODEL" in status + assert np.isnan(status["DURATION"].values[0]) # Unsupported time syntax + + with open(str(tmpdir.join("realization-0/STATUS")), "w") as status_fh: + status_fh.write("first line always ignored\n") + status_fh.write("INCLUDE_PC : 12:40:33 .... 12:41 \n") + real = ensemble.ScratchRealization(str(tmpdir.join("realization-0"))) + status = real.get_df("STATUS") + assert len(status) == 1 + assert "FORWARD_MODEL" in status + assert np.isnan(status["DURATION"].values[0]) # Unsupported time syntax + def test_batch(): """Test batch processing at time of object initialization"""