nuclearpinguin commented on a change in pull request #7314: [AIRFLOW-6698] Add
shorthand notation for lineage
URL: https://github.com/apache/airflow/pull/7314#discussion_r373776933
##########
File path: airflow/providers/papermill/operators/papermill.py
##########
@@ -45,19 +45,26 @@ class PapermillOperator(BaseOperator):
:param parameters: the notebook parameters to set
:type parameters: dict
"""
+ supports_lineage = True
+
@apply_defaults
def __init__(self,
- input_nb: str,
- output_nb: str,
- parameters: Dict,
+ input_nb: Optional[str] = None,
+ output_nb: Optional[str] = None,
+ parameters: Optional[Dict] = None,
*args, **kwargs) -> None:
super().__init__(*args, **kwargs)
- self.inlets.append(NoteBook(url=input_nb,
- parameters=parameters))
- self.outlets.append(NoteBook(url=output_nb))
+ if input_nb:
+ self.inlets.append(NoteBook(url=input_nb,
+ parameters=parameters))
+ if output_nb:
+ self.outlets.append(NoteBook(url=output_nb))
def execute(self, context):
+ if not self.inlets or not self.outlets:
+ raise ValueError("Input notebook or output notebook is not
specified")
Review comment:
I don't like it. We should raise this error in `__init__` to inform users as
soon as possible that their DAG will fail if they do not specify inlets and
outlets.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services