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/01/03 09:07:06 UTC

[GitHub] [airflow] nuclearpinguin commented on a change in pull request #6756: [AIRFLOW-6198] Add types to core classes.

nuclearpinguin commented on a change in pull request #6756: [AIRFLOW-6198] Add types to core classes.
URL: https://github.com/apache/airflow/pull/6756#discussion_r362738222
 
 

 ##########
 File path: airflow/models/dag.py
 ##########
 @@ -488,56 +506,65 @@ def normalize_schedule(self, dttm):
         return dttm
 
     @provide_session
-    def get_last_dagrun(self, session=None, include_externally_triggered=False):
-        return get_last_dagrun(self.dag_id, session=session,
-                               include_externally_triggered=include_externally_triggered)
+    def get_last_dagrun(self, session: Session = None, include_externally_triggered: bool = False) \
+            -> Optional[DagRun]:
+        """Returns last dagrun for my Dag"""
+        if self.dag_id:
+            return get_last_dagrun(self.dag_id, session=session,
+                                   include_externally_triggered=include_externally_triggered)
+        return None
 
     @property
-    def dag_id(self):
+    def dag_id(self) -> Optional[str]:
         return self._dag_id
 
     @dag_id.setter
-    def dag_id(self, value):
+    def dag_id(self, value: str):
         self._dag_id = value
 
     @property
-    def full_filepath(self):
+    def full_filepath(self) -> str:
         return self._full_filepath
 
     @full_filepath.setter
-    def full_filepath(self, value):
+    def full_filepath(self, value: str):
         self._full_filepath = value
 
     @property
-    def concurrency(self):
+    def concurrency(self) -> int:
         return self._concurrency
 
     @concurrency.setter
-    def concurrency(self, value):
+    def concurrency(self, value: int):
         self._concurrency = value
 
     @property
-    def access_control(self):
+    def access_control(self) -> Optional[Dict[str, str]]:
+        """Returns dictionary describing access control"""
         return self._access_control
 
     @access_control.setter
-    def access_control(self, value):
+    def access_control(self, value: Dict[str, str]):
         self._access_control = value
 
     @property
-    def description(self):
+    def description(self) -> Optional[str]:
+        """Returns DAG description"""
         return self._description
 
     @property
-    def pickle_id(self):
+    def pickle_id(self) -> Optional[str]:
+        """Returns ID used to pickle the DAG."""
         return self._pickle_id
 
     @pickle_id.setter
-    def pickle_id(self, value):
+    def pickle_id(self, value: str):
 
 Review comment:
   ```suggestion
       def pickle_id(self, value: str) -> None:
   ```

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