Hi,
I agree with Sebastiaan, but depending on your needed precision (do you need second-precision, or an error of up to a minute is OK?) and if your daemon was correctly running at the time the calculations crashed, probably the time of the parsed results node will be ~30-60s later than the end time and could be good enough.
From AiiDA’s point of view, indeed, the start time is unknown, you have to hope that either the job wrote it, or you have the info in the scheduler.
I’d recommend to double check again the last_job_info
(or similarly named) attribute of the calcjob. We introduced it at the very beginning of AiiDA exactly for this purpose. There was a bug fixed several months ago, so it might not be there if you have an “oldish” version of AiiDA, but otherwise you should have it. If you have slurm, the info should be there, the command was working 10 years ago so I doubt you have a SLURM version without the sacct
command (unless you have a version with a different command line… in which case, it would be useful for us to know so we can improve the SLURM plugin).
It would be very useful for us to know if you have it or not, if it’s empty, etc.
In any case, if none of the above works/applies, here is some code using AiiDA to simplify connecting via SSH to the computer and get file information, assuming the variable calcjobnode
is the CalcJob node:
path = calcjobnode.outputs.remote_folder.get_remote_path()
# Here you will have to append a filename to the path (that is just the remote folder),
# e.g. path = os.path.append(path, '_scheduler-stderr.txt') or similar
computer = calcjobnode.computer
with calcjobnode.get_transport() as t:
mode = t.get_attribute(path)
print(mode)
This will return a FileAttribute
object, similar to this:
FileAttribute({'st_size': 2596, 'st_uid': 501, 'st_gid': 20, 'st_mode': 33188, 'st_atime': 1702307526.9606802, 'st_mtime': 1702307520.9999373})
where you have UID, GID, file size, file mode, and also atime and mtime. These should follow the output of the stat
module, so check the docs there for the meaning of the various times and how to convert to actual times.
Important note: you will open a new SSH connection at every with
block. So if you have to check multiple files on the same computer, it’s better to create a list of paths, and open the connection once and run all commands inside the with
in a for loop, otherwise you risk to be banned out of the supercomputer center!