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

__name__ is not defined on functools.partial objects #83

Open
phargogh opened this issue Jan 24, 2023 · 0 comments
Open

__name__ is not defined on functools.partial objects #83

phargogh opened this issue Jan 24, 2023 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@phargogh
Copy link
Member

To reproduce:

  1. create a task with a functools.partial object as the target callable.
  2. run the graph.

The resulting exception is:

[1] [14:18:57.480] [main.js] Traceback (most recent call last):
[1]   File "/Users/jdouglass/workspace/phargogh/invest/env310/bin/invest", line 8, in <module>
[1]
[1] [14:18:57.480] [main.js]     sys.exit(main())
[1]   File "/Users/jdouglass/workspace/phargogh/invest/src/natcap/invest/cli.py", line 486, in main
[1]     model_module.execute(parsed_datastack.args)
[1]   File "/Users/jdouglass/workspace/phargogh/invest/src/natcap/invest/urban_nature_access.py", line 572, in execute
[1]     kernel_tasks[search_radius_m] = graph.add_task(
[1]   File "/Users/jdouglass/workspace/phargogh/invest/env310/lib/python3.10/site-packages/taskgraph/Task.py", line 625, in add_task
[1]
[1] [14:18:57.481] [main.js]     new_task = Task(
[1]   File "/Users/jdouglass/workspace/phargogh/invest/env310/lib/python3.10/site-packages/taskgraph/Task.py", line 1003, in __init__
[1]
[1] [14:18:57.481] [main.js]     scrubbed_value = _scrub_task_args(arg, self._target_path_list)
[1]   File "/Users/jdouglass/workspace/phargogh/invest/env310/lib/python3.10/site-packages/taskgraph/Task.py", line 1459, in _scrub_task_args
[1]
[1] [14:18:57.481] [main.js]     return '%s:%s' % (base_value.__name__, source_code)
[1] AttributeError: 'functools.partial' object has no attribute '__name__'. Did you mean: '__ne__'?

I can work around this by adding a __name__ attribute, but it'd be great if taskgraph could fall back to a default name if the name attribute didn't exist.

@phargogh phargogh added the bug Something isn't working label Jan 24, 2023
@phargogh phargogh added this to the 1.0 milestone Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant