You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/02/01 14:54:07 UTC

[GitHub] [airflow] bolkedebruin commented on a change in pull request #7314: [AIRFLOW-6698] Add shorthand notation for lineage

bolkedebruin commented on a change in pull request #7314: [AIRFLOW-6698] Add shorthand notation for lineage
URL: https://github.com/apache/airflow/pull/7314#discussion_r373783904
 
 

 ##########
 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 agree but can you propose how to do that if with short hand notation inlets/outlets are set after initialization has taken place of the operator?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services