vsoch / scif

scientific filesystem: a filesystem organization for scientific software and metadata
https://sci-f.github.io/
Mozilla Public License 2.0
30 stars 13 forks source link

Exit Code from scif run #67

Open dmachi opened 6 months ago

dmachi commented 6 months ago

When launching an app with run, a zero exit code is always returned. As far as I can tell, the code will only return the app's exit code if _exec is called with interactive=True and exit=True. The run() command has interactive explicitly set to False on https://github.com/vsoch/scif/blob/master/scif/main/commands.py#L166. Is there anyway to force that exit code to return properly?

vsoch commented 6 months ago

If you want to open a PR to expose that variable, that would be welcome. The expected use case is that if you are wanting interactive, you'd be using exec.

dmachi commented 6 months ago

Thank you for the prompt reply. Is there some reason why one would NOT want run() to return the exit code of the thing it is running? I'm curious because apptainer does return that exit code from the app run. It makes it difficult to include this in other scripts without an exit code. I am happy to create patch and PR for this, but am wondering if you would accept it if run just always exited with whatever exit code the command exited with?

vsoch commented 6 months ago

Honestly this project is so old I don't remember the details. I agree with you it makes sense to return it, and I'm happy to accept a PR.

dmachi commented 6 months ago

LOL. We were wondering if it was still alive :). We'll get a patch created if we don't find a lazier alternative solution.

vsoch commented 6 months ago

I maintain hundreds of projects, so I will work on them on an as-needs basis. I'm glad you are using SCIF!

dmachi commented 6 months ago

I've created PR #68 to address this.

vsoch commented 6 months ago

Closed with #68

vsoch commented 6 months ago

@dmachi we broke upstream tests, so I had to revert and we will need to address this in another way.

dmachi commented 6 months ago

@vsoch Can you be more specific on what upstream tests are failing so I can figure out how to fix this. Am I able to see those tests and results? I thought my changes should only really add that exit code after the output of the job (which it was already doing).

vsoch commented 6 months ago

See #70

vsoch commented 6 months ago

@dmachi perhaps we can try https://stackoverflow.com/questions/70692908/how-to-get-the-exit-code-for-os-popencommand ?

vsoch commented 6 months ago

and ping @dtrudg - let's make sure we add a test this time to not break things.