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 15:11:00 UTC

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

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

 ##########
 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 think it's ok to have it at execute time - no matter if we use builder pattern or the shorthand operators, it cannot be done init().

----------------------------------------------------------------
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