question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Can I see currently running jobs?

See original GitHub issue

Is there a possibility to differentiate between a taskid that is currently running and just doesn’t exist? While it’s running, the taskid isn’t present in huey.all_results() and get(taskid) returns None. After completion it is present in all_results() and get(taskid) returns the result as expected.

Background: I’m writing an API where a post to endpoint A starts a task and I want to provide an endpoint B that allows polling of the task status. Now I would like to provide different status response for a plain invalid taskid and a currently running taskid.

I’m using sqlite for storage. Is that the cause? Or do I need to use signals and write to the sqlite?

Even more background on what i’m doing:

app.py:

from flask import Flask, url_for
import worker
from huey import SqliteHuey

huey = SqliteHuey(filename='worker.db', fsync=True)

app = Flask(__name__)

@app.route("/create/<a>", methods=["POST"])
def create_task(a):
    task = worker.create_hue_task(a)
    return task.id, 204

@app.route("/allresults")
def allresults():
    return str(huey.all_results())

worker.py:

import time

from huey import SqliteHuey

huey = SqliteHuey(filename='worker.db', fsync=True)

@huey.task()
def create_hue_task(a):
    time.sleep(20)
    return a+a

and then just start the worker and the app:

huey_consumer worker.huey
# in another shell
flask run

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
coleifercommented, Mar 12, 2022

Oh, I suppose if the operating system kills the worker process for using all the ram…but if that’s the case you’ve got bigger problems.

1reaction
coleifercommented, Mar 12, 2022

That’s actually been added. Bear in mind this only occurs if you hard shutdown the consumer. Graceful shutdown finishes all running tasks.

https://huey.readthedocs.io/en/latest/signals.html

See SIGNAL_INTERRUPTED

Read more comments on GitHub >

github_iconTop Results From Across the Web

sql server - how to know status of currently running jobs
@GoldenLion, right-click on the job you ran and select job history. Then expand the failed job log. You can scroll down and see...
Read more >
Script to see running jobs in SQL Server with Job Start Time
Show activity on this post. I posted a query a while back for getting a list of currently running jobs here. SELECT ja....
Read more >
How to tell when a scheduled job is running
Answer: These views will show already currently running scheduled jobs: v$session; dba_scheduler_running_chains; dba_scheduler_running_jobs; v$ ...
Read more >
How to see all jobs that are currently running - UiPath Forum
Is there a way to see all the active jobs at a global/tenant level ? You can find all configured Robots in Robots...
Read more >
How to see Which all Scheduled jobs are running an...
How to see Which all Scheduled jobs are running and which all jobs failed ? Basically need to see current status for running...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found