Skip to content

Custom Timetables must be imported relative to $PLUGINS_FOLDER #23758

Answered by uranusjr
Gollum999 asked this question in General
Discussion options

You must be logged in to vote

The asterisk is optional in this case. It means run_after can only be called as a keyword argument, while the example code allows the caller to use it as either positional or keyword. But since the function is always only called with keyword arguments in Airflow, both syntax will work. The example code is not wrong.

As for the absolute import issue, unfortunately this is a (somewhat obsecure and annoying) problem in Python. If you add a directory in sys.path via multiple paths, names imported from different sys.path items have different identities.

$ tree
.
`-- plugins
    |-- __init__.py
    `-- mod.py
$ cat plugins/mod.py
class A:
    pass
$ PYTHONPATH=plugins python -q  # Simulate how …

Replies: 5 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@ForeverWintr
Comment options

@potiuk
Comment options

@ForeverWintr
Comment options

@potiuk
Comment options

@uranusjr
Comment options

Answer selected by Gollum999
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug This is a clearly a bug area:core
6 participants
Converted from issue

This discussion was converted from issue #21259 on May 17, 2022 16:18.