jhuckaby / Cronicle

A simple, distributed task scheduler and runner with a web based UI.
http://cronicle.net
Other
3.94k stars 391 forks source link

get_live_job_log doesn't work for detached jobs #786

Closed matthewjhands closed 4 months ago

matthewjhands commented 4 months ago

Summary

When you create a detached job, the /api/app/get_live_job_log fn returns a no such file or directory error because it is looking for logs/jobs/$JOBID.log and not logs/jobs/$JOBID-detached.log.

Steps to reproduce the problem

  1. Create any detached job.
  2. Start the new job.
  3. Open the Job Details page for it, observe the "Live Job Event Log" is working, and returning logs.
  4. Click "View Full Log" on the right hand side of the screen.
  5. You should have been navigated to http://$PRIMARYURL/api/app/get_live_job_log?id=$JOBID, observe that the response is {"code":"job","description":"Failed to fetch job log: Error: ENOENT: no such file or directory, stat 'logs/jobs/$JOBID.log'"}
  6. Meanwhile, in a terminal run ls -la /opt/cronicle/logs/jobs/. Observe that a job log exists named logs/jobs/$JOBID-detached.log and not logs/jobs/$JOBID.log.

Your Setup

Operating system and version?

Ubuntu 22.04

Node.js version?

v20.15.0

Cronicle software version?

0.9.52

Are you using a multi-server setup, or just a single server?

Single Primary, no workers.

Are you using the filesystem as back-end storage, or S3/Couchbase?

Local FS

Can you reproduce the crash consistently?

Yes

Log Excerpts

jhuckaby commented 4 months ago

Fixed in Cronicle v0.9.56. Thanks!

Note that you'll have to upgrade Cronicle on ALL your servers for this to take effect. However, I see you're using a single primary and no workers, so that's easy then. Just a single upgrade for you. Thanks again!

https://github.com/jhuckaby/Cronicle/blob/master/docs/CommandLine.md#upgrading-cronicle

matthewjhands commented 4 months ago

Thank you! That's great.