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.

Questions: Has task run? Is running task completed?

See original GitHub issue

How can i check if a task has been called/run/completed?

Currently i looked into HUEY.pending() and check if there the task has a result.

First: How can i easier get all pending task IDs? I do this:

def get_pending_ids_by_func(task_func):
    task_pkg_path1 = "%s.%s" % (task_func.task_class.__module__, task_func.task_class.__name__)
    
    pending_ids=set()
    
    for pending_task in HUEY.pending(limit=None):
        task_pkg_path2 = "%s.%s" % (pending_task.__module__, pending_task.name)
        if task_pkg_path1 == task_pkg_path2:
            pending_ids.add(pending_task.task_id)
            
    return pending_ids

Then: I have the task ID and what to check if the task finished. Currently i check if result is not EmptyData, e.g.:

result = HUEY.storage.peek_data(key=task_id)
if result is not EmptyData:
    print("Task %r completed" % task_id)
else:
    print("Task %r return EmptyData -> not completed." % task_id)

But it seems that this will not work, if the task return something and not return None

Issue Analytics

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

github_iconTop GitHub Comments

14reactions
coleifercommented, Dec 27, 2018

If I were your employer I’d probably fire you for wasting so much time.

2reactions
jediecommented, Dec 17, 2018

This isn’t about testing Huey himself. It’s about testing the whole stack. That includes huey and redis as backend…

In my case it’s a docker compose project and django, huey, redis (and more) services are in separate containers…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to determine whether Task.Run is completed within a loop
I am using C#. I am stress testing so this is not quite production code. I upload data to my server via a...
Read more >
Using Task.Run in Conjunction with Async/Await | Pluralsight
Run returns a Task which means you can use the await keyword with it! So let's explore using Task.Run in conjunction with async/await...
Read more >
C# regarding running multiple task - Microsoft Q&A
Run (() =>; {; });; // Block until both tasks have completed. // This makes this method prone to deadlocking. // Consider using...
Read more >
How to daisy chain tasks in the Windows Task Scheduler to ...
First we need to setup task X if you have not done so already with all the actions that you need for that...
Read more >
Tasks in Visual Studio Code
When the compiler has finished, there should be a HelloWorld.js file. ... If you have cloned the eslint-starter example, then executing Run Tasks...
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