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

Tiny edit to allow target naming templating to be used #59

Closed

Conversation

norlandrhagen
Copy link

Change Summary

While using funnel for caching, I ran into an unexpected error when trying to apply formatting for target names based on prefect parameters.

traceback: ```└── 16:41:35 | ERROR | Unexpected error: KeyError('gcm') Traceback (most recent call last): File "/Users/nrhagen/opt/anaconda3/envs/install/envs/cmip6-jupyter/lib/python3.9/site-packages/prefect/engine/runner.py", line 48, in inner new_state = method(self, state, *args, **kwargs) File "/Users/nrhagen/opt/anaconda3/envs/install/envs/cmip6-jupyter/lib/python3.9/site-packages/prefect/engine/task_runner.py", line 926, in get_task_run_state result = self.result.write(value, **formatting_kwargs) File "/Users/nrhagen/opt/anaconda3/envs/install/envs/cmip6-jupyter/lib/python3.9/site-packages/funnel/prefect/result.py", line 72, in write new = self.format(**{}) File "/Users/nrhagen/opt/anaconda3/envs/install/envs/cmip6-jupyter/lib/python3.9/site-packages/prefect/engine/result/base.py", line 133, in format new.location = new.location.format(**kwargs) KeyError: 'gcm' └── 16:41:35 | INFO | Task 'test_kwargs': Finished task run for task with final state: 'Failed' └── 16:41:35 | INFO | Flow run FAILED: some reference tasks failed. Flow run failed!

By editing line 72 of funnel/prefect/result.py from new = self.format(**{}) to new = self.format(**kwargs), the targeting templating seemed to succeed.

Related issue number

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable

PS This package has been incredibly useful, thanks for all the work developing it.

…th kwargs. Allowed target naming templating to be used.
@andersy005
Copy link
Contributor

andersy005 commented Dec 15, 2021

Thank you for putting this together, @norlandrhagen! We recently decided to move the caching functionality from funnel into a standalone package: https://github.com/NCAR/xpersist (ncar-xdev/xpersist#35). Do you mind opening the PR over there instead?

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

Successfully merging this pull request may close these issues.

2 participants