Skip to content

AIP-81 Trasition of Remote Commands #45661

Closed
10 of 10 issues completed
Closed

Description

@bugraoz93

Description

Transition of Remote Commands, below are remote commands. We should integrate CLI API client and call API endpoints to eliminate sessions and direct database calls from remote commands.

  • asset
  • backfill
  • config
  • connection
  • dag
  • jobs
  • pool
  • provider
  • task (This will be decided after discussion, that's why there is no sub-issue for it, it will be updated)
  • variable
  • version

Dependency

#45300 should be merged.

Use case/motivation

AIP-81

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Sub-issues

Sub-issues

10 of 10 Issues completed
Loading 10 sub-issues

Activity

  1. added
    AIP-81
    kind:feature
    on Jan 15, 2025
  2. added
    area:API
    on Jan 15, 2025
  3. 7 remaining items

  4. bugraoz93 commented on Apr 6, 2025

    @bugraoz93
    ContributorAuthor

    @bugraoz93 While developing dags commands, server commands may share arguments (dag_id, output, verbose, etc.) It seems to cause conflicts and complications when PRs are merged. Would it be better to write the arguments that are common to commands under #shared and resolve conflicts in the order in which PRs are merged? (like this)

    What do you mean by server commands? If you mean something like dag-processor. Those won't be available in airflowctl. Most shared ARGs are used more on dags and tasks. We won't transition any tasks commands yet either at the first iteration. The first plan was in the airflow-core which then flatten into commands. This could be a good baseline. What has been reverted under remote commands in the combination for further granular split. These are now aiming to be in airflowctl :)
    #48224
    #47538

    I believe that for ARGs and or a PR merged in cli_config.py, there should be a one-time conflict for all downstream PRs when the ARG is added. Even though we added the ARGs first, this is inevitable. I am okay with merging the ARGs early on, but that won't be enough for conflicts. If we put them in order with comments, that could potentially ease the rebase process.

  5. jx2lee commented on Apr 7, 2025

    @jx2lee
    Contributor

    @bugraoz93 Really appreciate the super detailed answer! I'll write up PR soon 🙆‍♂️

  6. bugraoz93 commented on Apr 7, 2025

    @bugraoz93
    ContributorAuthor

    Hey all,
    The dynamic generation of commands PR(#48146) has been merged. Before adding a new Action/Group Command, we must extend the existing GroupCommands under command_factory.group_commands, which persist all auto-generated Group and Action commands. It is iterable, so we can find a generic way to include ActionCommand under, for example, pools GroupCommand. I will include a mechanism soon, but feel free to include it if you are already near the adding into cli_config.py, it should be just extending the subcommands iterable.

  7. Prab-27 commented on Apr 11, 2025

    @Prab-27
    Contributor

    Sorry, I don't understand ! @bugraoz93, as you mentioned, I have checked that the Jobs command is added to airflowctl, and its subcommands are also added and working fine. However, when I try to execute an operations command like airflowctl jobs list, I encounter an issue. It throws the following error

    airflowctl jobs list

    Traceback (most recent call last):
      File "/usr/local/bin/airflowctl", line 10, in <module>
        sys.exit(main())
      File "/opt/airflow/airflow-ctl/src/airflowctl/__main__.py", line 33, in main
        args.func(args)
      File "/opt/airflow/airflow-ctl/src/airflowctl/api/client.py", line 298, in wrapper
        with get_client(kind=kind) as api_client:
      File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
        return next(self.gen)
      File "/opt/airflow/airflow-ctl/src/airflowctl/api/client.py", line 275, in get_client
        raise e
      File "/opt/airflow/airflow-ctl/src/airflowctl/api/client.py", line 266, in get_client
        credentials = Credentials().load()
      File "/opt/airflow/airflow-ctl/src/airflowctl/api/client.py", line 146, in load
        raise AirflowCtlNotFoundException(f"No credentials found in {default_config_dir}")
    airflowctl.exceptions.AirflowCtlNotFoundException: No credentials found in /root/.config/airflow
    

    I am wondering if this issue is related to missing credentials or something else. I believe the remote commands were added successfully. Could you please clarify?

  8. bugraoz93 commented on Apr 11, 2025

    @bugraoz93
    ContributorAuthor

    Sorry, I don't understand ! @bugraoz93, as you mentioned, I have checked that the Jobs command is added to airflowctl, and its subcommands are also added and working fine. However, when I try to execute an operations command like airflowctl jobs list, I encounter an issue. It throws the following error

    airflowctl jobs list

    Traceback (most recent call last):
      File "/usr/local/bin/airflowctl", line 10, in <module>
        sys.exit(main())
      File "/opt/airflow/airflow-ctl/src/airflowctl/__main__.py", line 33, in main
        args.func(args)
      File "/opt/airflow/airflow-ctl/src/airflowctl/api/client.py", line 298, in wrapper
        with get_client(kind=kind) as api_client:
      File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
        return next(self.gen)
      File "/opt/airflow/airflow-ctl/src/airflowctl/api/client.py", line 275, in get_client
        raise e
      File "/opt/airflow/airflow-ctl/src/airflowctl/api/client.py", line 266, in get_client
        credentials = Credentials().load()
      File "/opt/airflow/airflow-ctl/src/airflowctl/api/client.py", line 146, in load
        raise AirflowCtlNotFoundException(f"No credentials found in {default_config_dir}")
    airflowctl.exceptions.AirflowCtlNotFoundException: No credentials found in /root/.config/airflow
    

    I am wondering if this issue is related to missing credentials or something else. I believe the remote commands were added successfully. Could you please clarify?

    @Prab-27 Yeah, some of the commands already covered with the auto generation part, which I tagged the PR earlier in this issue. I am currently adding docs, so it is a bit empty on the documentation side. Sorry about that!
    You can use the following commands before executing any of the commands.

    airflowctl auth login --username=admin --password

    Enter admin again hit enter. It should authenticate accordingly. Then, you can execute any of the commands. If you think your story is covered by auto generation, check as you do, and we can close the issue :) Thanks!

  9. aritra24 commented on Apr 11, 2025

    @aritra24
    Collaborator

    @bugraoz93 do you think we should add a redirect to login in the other commands if auth is missing? Or just change command output to be more explicit in asking to login first? I can pick that up if you think that makes sense.

  10. bugraoz93 commented on Apr 11, 2025

    @bugraoz93
    ContributorAuthor

    @bugraoz93 do you think we should add a redirect to login in the other commands if auth is missing? Or just change command output to be more explicit in asking to login first? I can pick that up if you think that makes sense.

    Thanks @aritra24! I thought I handled this in communication PR, but it seems I deleted it to scope down it. 6d6a3c7

    Here you go, assinged it to you :) There were comments on not printing users from a deeper level. Maybe we can handle this in the decorator or create another one to check the credentials first on the command level. Thanks!
    #49139

  11. amarlearning commented on Apr 12, 2025

    @amarlearning
    Contributor

    Hi @bugraoz93, is there anything I can help with on this?

  12. bugraoz93 commented on Apr 12, 2025

    @bugraoz93
    ContributorAuthor

    Hi @bugraoz93, is there anything I can help with on this?

    @amarlearning thanks for your interest! All the issues are assigned at the moment. I will make a last scan and will create final issues if there are. Let me ping you again :)

  13. jason810496 commented on Apr 13, 2025

    @jason810496
    Member

    Hi @amarlearning, I currently don’t have the bandwidth to work on both issues.
    If you’re interested, I’d be happy to assign either the Pools one or the Variable one to you. Let me know which you'd prefer!

  14. amarlearning commented on Apr 13, 2025

    @amarlearning
    Contributor

    Thanks, @jason810496!😄 I can take the Pools one. Please assign it to me.

  15. bugraoz93 commented on May 19, 2025

    @bugraoz93
    ContributorAuthor

    Hey all, thanks for the attention and all the work done!
    Let's speed the work up a bit if possible. If you cannot, that is okay too :) I am going to start working on the not-started items and start helping out if I haven't seen any movement for a while. Please shout if you don't have time. I will put a comment on which one I am going to start :)
    We should start testing soon and fix all the bugs without racing against time. There will be follow-up discussions and improvements on airflowctl after release, please feel free to jump in again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    AIP-81area:APIarea:CLIkind:feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions