Hi,
I have a method named main it takes **kwargs as a parameter.
def main(**kwargs):
parameterOne = kwargs["param-one"]
parameterTwo = kwargs["param-two"]
parameterThree = kwargs["param-optional-one"] if "param-optional-one" in kwargs else None
parameterFour = kwargs["param-optional-two"] if "param-optional-two" in kwargs else None
I have declared it as an entry_point in setup
entry_points={
'console_scripts': [
'main=ETL.V1:main'
]
},
I am passing keyword arguments in task
"entry_point": "main",
"named_parameters": {
"param-one": "test",
"param-two": "test two"
}
when I run the job it goes into main method, but fails on the very first line
KeyError: 'param-one'
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<command--1> in <module>
16 if entry:
17 # Load and execute the entrypoint, assumes no parameters
---> 18 entry[0].load()()
19 else:
20 import ETL.V1
/databricks/python/lib/python3.8/site-packages/ETL/V1.py in main(**kwargs)
8 for i, v in kwargs.items():
9 print(" ", i, ": ", v)
---> 10 parameterOne = kwargs['param-one']
11 parameterTwo = kwargs['param-two']
KeyError: 'param-one'
The keyword arguments are not being passed or I am doing something wrong?
I tried to see if anything is in kwargs, however that didn't print anything in the task output just the error above was displayed. So, I can't really tell if anything is in kwargs or not.