thieman / dagobah

Simple DAG-based job scheduler in Python
Do What The F*ck You Want To Public License
755 stars 160 forks source link

get_status method for job #178

Closed cmishra closed 7 years ago

cmishra commented 7 years ago

Is there one? I can't seem to find it and have been using job.state.status, which would break if state member was modified in any way in the future.

I can try to do the leg work of adding this in if you'd prefer.

thieman commented 7 years ago

Hi there! As a disclaimer, I'm not very active with the project any more so my advice here may be wrong.

I believe the correct way to do this is through the path you mention (job.state.status). Maintaining a reference to the state object and querying its status repeatedly would result in stale data (as you correctly point out). Instead, I think what you want to do is hold a reference to the job itself and, whenever you want to know the current state, get the current state and look at the status on that. That should survive any changes to the state as the job moves through its lifecycle.

cmishra commented 7 years ago

What I meant was that job.state.status seemed inferior to job.get_status() due to the latter better abstracting retrieving status from how status is stored/maintained. But since this code will likely be relatively static going forward I can understand how this really isn't necessary.

I completely misunderstood your comment the first time I read it. You're right, job.state.status works perfectly fine (for now). But again, since developments aren't planned this probably isn't very important.

I'm trying to develop a command line interface manager for dagobah jobs with slack notificatinos, so such functionality would be somewhat nice for my personal workflow. I'll likely make certain extensions/implementations, but it would probably be easier for me to do this on a fork of dagobah instead of modifying it here.