-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AIRFLOW-4222] Add cli autocomplete for bash & zsh #5789
Conversation
|
||
.. code-block:: bash | ||
|
||
eval "$(register-python-argcomplete airflow)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have this as airflow autocompletions
or something (which just tries to import that module etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure as it would have to find out current Shell (bash/zsh - which might be easy) and then export that command to .bash_rc
or .bash_profile
or .zshrc
etc by running some bash commands?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the register-python-argcomplete airflow
bit - not the eval etc.
So this line would be
eval "$(register-python-argcomplete airflow)" | |
eval "$(airflow autocompletions)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aah ok. That should be plausible. Let me give it a go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well this isn't as trivial as I thought it would because just running airflow
prints out the following:
/Users/kaxilnaik/Documents/GitHub/incubator-airflow/airflow/models/dagbag.py:21: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
[2019-08-13 22:30:04,803] {settings.py:173} INFO - settings.configure_orm(): Using pool settings. pool_size=5, max_overflow=10, pool_recycle=1800, pid=86597
/Users/kaxilnaik/.virtualenvs/airflow_cli_test/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
""")
[2019-08-13 22:30:04,876] {__init__.py:51} INFO - Using executor LocalExecutor
If we then run eval $(airflow autocomplete)
it gives the following error:
/Users/kaxilnaik/Documents/GitHub/incubator-airflow/airflow/models/dagbag.py:21: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
/Users/kaxilnaik/.virtualenvs/airflow_cli_test/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
""")
zsh: bad pattern: [2019-08-13
as it is trying to parse the log line [2019-08-13 22:29:39,045] {settings.py:173} INFO - settings.configure_orm(): Using pool settings. pool_size=5, max_overflow=10, pool_recycle=1800, pid=86465
Hence, not implementing this as part of this PR. Let's revisit this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that damn logging whenever we import airflow
:(
What do you think to add DAG/Task name suggestion? I think this library supports it. |
@mik-laj It would have to access the DB to get task name and Dag Name. Let's merge this one so we get a basic auto-completer. And then we can add functionalities to it. Some of the things I will add this week would be around filename completions |
Docs errors:
|
(cherry picked from commit 44eb89d)
(cherry picked from commit 44eb89d)
Make sure you have checked all steps below.
Jira
Description
Tests
Commits
Documentation
Code Quality
flake8