KostyaEsmukov commented on issue #8151: BugFix: Fix writing & deleting Dag Code 
for Serialized DAGs
URL: https://github.com/apache/airflow/pull/8151#issuecomment-609438272
 
 
   @kaxil Thanks for the fix! The scheduler errors are gone, but on a stateless 
webserver the code is still not rendered, because, apparently, `DagCode` 
instance always tries to read the code from a local file during initialization:
   
   ```
   >>> DagCode(dag_orm.fileloc)
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "<string>", line 4, in __init__
     File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/state.py", 
line 433, in _initialize_instance
       manager.dispatch.init_failure(self, args, kwargs)
     File 
"/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 
69, in __exit__
       exc_value, with_traceback=exc_tb,
     File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", 
line 178, in raise_
       raise exception
     File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/state.py", 
line 430, in _initialize_instance
       return manager.original_init(*mixed[1:], **kwargs)
     File "/usr/local/lib/python3.7/site-packages/airflow/models/dagcode.py", 
line 59, in __init__
       self.source_code = DagCode._read_code(self.fileloc)
     File "/usr/local/lib/python3.7/site-packages/airflow/models/dagcode.py", 
line 63, in _read_code
       with open_maybe_zipped(fileloc, 'r') as source:
     File "/usr/local/lib/python3.7/site-packages/airflow/utils/file.py", line 
102, in open_maybe_zipped
       return io.open(fileloc, mode=mode)
   FileNotFoundError: [Errno 2] No such file or directory: '<...my_dag...>'
   ```
   
   Notice the `_read_code` line.

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

Reply via email to