气流initdb期间BadZipFile错误,dag问题

时间:2020-02-27 08:21:54

标签: python zip virtual-machine airflow directed-acyclic-graphs

我写了一个dag,将其放在vm的airflow / dags中,当我运行airflow initdb时,出现以下问题

navigator.mediaDevices

我不确定是什么问题。我查看了源代码,并认为当dags文件夹中没有zip文件时,它会以某种方式期待

数据包含

(env) (base) xxxx@XXXXXX:~/airflow/dags$ airflow initdb
[2020-02-27 08:06:19,564] {settings.py:253} INFO - settings.configure_orm(): Using pool settings. pool_size=5, max_overflow=10, pool_recycle=1800, pid=105407
DB: postgresql+psycopg2://bn_airflow%40XXXXXXX?sslmode=require
[2020-02-27 08:06:20,236] {db.py:368} INFO - Creating tables
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
ERROR [airflow.models.dagbag.DagBag] Bad magic number for central directory
Traceback (most recent call last):
  File "/home/pgkrdatahub/.local/lib/python3.6/site-packages/airflow/models/dagbag.py", line 420, in collect_dags
    safe_mode=safe_mode)
  File "/home/pgkrdatahub/.local/lib/python3.6/site-packages/airflow/models/dagbag.py", line 251, in process_file
    zip_file = zipfile.ZipFile(filepath)
  File "/usr/lib/python3.6/zipfile.py", line 1131, in __init__
    self._RealGetContents()
  File "/usr/lib/python3.6/zipfile.py", line 1226, in _RealGetContents
    raise BadZipFile("Bad magic number for central directory")
zipfile.BadZipFile: Bad magic number for central directory
ERROR [airflow.models.dagbag.DagBag] Bad magic number for central directory
Traceback (most recent call last):
  File "/home/pgkrdatahub/.local/lib/python3.6/site-packages/airflow/models/dagbag.py", line 420, in collect_dags
    safe_mode=safe_mode)
  File "/home/pgkrdatahub/.local/lib/python3.6/site-packages/airflow/models/dagbag.py", line 251, in process_file
    zip_file = zipfile.ZipFile(filepath)
  File "/usr/lib/python3.6/zipfile.py", line 1131, in __init__
    self._RealGetContents()
  File "/usr/lib/python3.6/zipfile.py", line 1226, in _RealGetContents
    raise BadZipFile("Bad magic number for central directory")
zipfile.BadZipFile: Bad magic number for central directory
Done.

SomReviewDailyDag从这些sommers文件夹中导入脚本。

SomReviewDailyDag看起来像这样

env) (base) pgkrdatahub@xxx:~/airflow/dags$ ls -al
total 32
drwxrwxr-x 5 pgkrdatahub pgkrdatahub 4096 Feb 27 08:06 .
drwxrwxr-x 4 pgkrdatahub pgkrdatahub 4096 Feb 27 04:36 ..
drwxrwxr-x 8 pgkrdatahub pgkrdatahub 4096 Feb 27 03:00 .git
-rw-rw-r-- 1 pgkrdatahub pgkrdatahub  109 Feb 27 03:00 README.md
-rw-rw-r-- 1 pgkrdatahub pgkrdatahub 5040 Feb 27 08:06 SomReviewDailyDag.py
drwxrwxr-x 2 pgkrdatahub pgkrdatahub 4096 Feb 27 08:06 __pycache__
drwxrwxr-x 8 pgkrdatahub pgkrdatahub 4096 Feb 27 06:44 sommers

我用谷歌搜索,但在气流中找不到任何对此问题的参考。

我发现了Bad magic number error with ZipFile module in Python

这表明标头必须是某个字符串。

但是我找不到其他东西可以弄清楚问题所在。帮助将不胜感激

0 个答案:

没有答案