Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delayed task is never executed if basename is set #30

Closed
smheidrich opened this issue Mar 21, 2015 · 3 comments
Closed

Delayed task is never executed if basename is set #30

smheidrich opened this issue Mar 21, 2015 · 3 comments
Milestone

Comments

@smheidrich
Copy link

Description

If I set the "basename" option of a task that has been created via doit.create_after, this task is never executed.

Minimal example to reproduce

Here is a minimal dodo.py file to reproduce the error. You can see from the output to sys.stderr that this is not merely a case of not reporting the task's run, but it actually doesn't run at all.
Note that removing either the "basename" option or the create_after decorator produces the "correct" behaviour; it is only when used together that they cause trouble.

dodo.py:

from doit import create_after
import sys

def say_hello(your_name):
  sys.stderr.write("Hello from {}!\n".format(your_name))

def task_a():
  return {
    "actions": [ (say_hello, [ "a" ] ) ]
  }

@create_after("a")
def task_b():
  return {
    "actions": [ (say_hello, [ "b" ] ) ],
    "basename": "B saying hello"
  }

Expected behaviour

Terminal log:

$ doit
.  a
Hello from a!
.  B saying hello
Hello from b!
$ 

Actual behaviour

Terminal log:

$ doit
.  a
Hello from a!
$ 

System information

  • doit version: 0.27.0
  • Python version: 3.4.2
@schettino72
Copy link
Member

The best bug report I ever got 👍

I forgot to write a note on docs about this... Since the metadata of a delayed task is only created on demand it is currently not possible to set a basename. doit needs to know which task-creator function needs to be execute the get the metadata of the requested task.

What I thought before was to extend the decorator to accept a creates argument, something like

@create_after("a", creates=['B saying hello'])
def task_b():
   ...

@schettino72
Copy link
Member

I added a note in docs about this limitation: 7fd9f9a

@schettino72 schettino72 removed the docs label Mar 22, 2015
@smheidrich
Copy link
Author

That was fast - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants