I have this DAG, but working to test this in jupyt...
# hamilton-help
s
I have this DAG, but working to test this in jupyter I am encountering this issue.
Error: Type requirement mismatch. Expected jira:<class 'jira.JiraAPI'> got <__main__.JiraAPI object at 0x0000028361459B50>:<class '__main__.JiraAPI'> instead.
Could this be due to this
JiraAPI
being defined in the same cell to use with
jupyter_magic
cell_to_module
?
👀 1
Additionally, I changed the type hint to
Any
but the error persists
t
I believe this is unrelated to the notebook/ Jupyter. Does this work in a script? When calling
.execute(...)
with the
inputs
kwargs, there is type validation on the input values. The way some libraries are typed, it can be problematic. I'm surprised that using
Any
in
raw_jira_issues_initial(jira: Any, ...)
doesn't fix the issue. What's the exception for that? As a workaround, can you try creating a function and see if it works?
Copy code
def jira(...) -> JiraAPI:
  return
To illustrate the potential problem with
inputs
. This would work because type hints match and there's no actual type enforcement on node results
Copy code
def foo() -> np.ndarray:
   return True

def bar(foo: np.ndarray) -> np.ndarray:
   return foo is True

dr.execute(["bar"])
This wouldn't work and raise
foo
isn't
np.ndarray
Copy code
def bar(foo: np.ndarray) -> np.ndarray:
  return foo is True

# ...

dr.execute(["bar"], inputs={"foo": True})
👍 1
s
Yes, I am using inputs
dr.execute(["all_paginated_responses"], inputs={"jira": jira_api, "jql": jql})
I'm surprised that using
Any
in
raw_jira_issues_initial(jira: Any, ...)
doesn't fix the issue. What's the exception for that?
When using
cell_to_module
does jupyter kernel need to be reloaded or is re-running the cell enough? I think that may be why I get the same exception
t
Each time you execute the cell that has
%%cell_to_module MODULE_NAME
it will update the module
MODULE_NAME
in memory. You can manually check that by calling
MODULE_NAME.raw_jira_issues_initial()
if you want
hmm, looking at the DAG, did you annotate
Any
on both
raw_jira_issues_initial
and
raw_jira_issues_responses
?
s
Each time you execute the cell that has
%%cell_to_module MODULE_NAME
it will update the module
MODULE_NAME
in memory.
That is what I would expect but when I amend the code to use
Any
instead, the
--display
'd DAG does not reflect the code changes
t
That's very surprising to me. Do you think you could share the notebook for me to inspect it?