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

Issue with named parameters during dbx execute #858

Open
GaniMarquez opened this issue Dec 5, 2023 · 1 comment
Open

Issue with named parameters during dbx execute #858

GaniMarquez opened this issue Dec 5, 2023 · 1 comment

Comments

@GaniMarquez
Copy link

Expected Behavior

Whenever I send named_parameters as part of my dbx execute, I want the workflow to use these parameters during runtime. This is already the case if I simply use just the normal positional parameters.

Current Behavior

DBX only parses that keys from the dict and not the values when it formats the arguments used by the task. It always assumes that a list of strings are sent as CLI arguments similar to what you would expect for positional parameters. The source code that performs this formatting is referenced here.

Steps to Reproduce (for bugs)

  1. Create a workflow with that uses python wheel for a task (ensure that you have named_parameter as part of the workflow definition.
  2. Run the DBX Execute
dbx execute test-workflow \
    --cluster-id='xxxx-xxxxxx-xxxxxxx' \
    --parameters='{"named_parameters": {"prediction-date": "2023-11-18", "tenant": "DE", "mode": "dev"}}'
  1. Check logs
  • DBX Logs
    Screen Shot 2023-12-05 at 11 17 55

Context

I am using a working with workflows using python wheels as tasks.

Your Environment

  • dbx version used: 0.8.18
  • Databricks Runtime version: 13.3 LTS ML
@GaniMarquez
Copy link
Author

GaniMarquez commented Dec 5, 2023

Suggestion:

I have already did a quick patch in my local dbx set-up by refactoring the function to this:

    def setup_arguments(self, arguments: Union[Dict, List[Any]]):
        if isinstance(arguments, dict):
            task_props = ["python"] + [f"--{arg}={value}" for arg, value in arguments.items()]
        else:
            task_props = ["python"] + [str(arg) for arg in arguments]
        setup_command = f"""
        import sys
        sys.argv = {task_props}
        """
        self._client.execute_command(setup_command, verbose=False)

But I wanted to know your thought if there's a better way to resolve this.

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

No branches or pull requests

1 participant