Skip to content
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

fix: Reorganize click.option decorators in the session create-from-template command #1890

Merged
merged 6 commits into from
Feb 28, 2024

Conversation

rapsealk
Copy link
Member

@rapsealk rapsealk commented Feb 6, 2024

This PR is a follow-up to #537 and #1406.

The session create-from-template CLI command was nonfunctional due to the following issues:

  1. An invalid keyword argument (type_ -> type).
  2. Incompatibility of several click.option decorators with the Undefined type.
  3. Incorrect placement order of click.option decorators. To override @click_start_options(), options must come after the decorator.
rapsealk@lablupucBookPro backend.ai-dev2 % ./backend.ai session create-from-template 45731b54432c43b49da1891846113d1d
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/rapsealk/Desktop/git/backend.ai-dev2/src/ai/backend/cli/__main__.py", line 10, in <module>
    main(max_content_width=shutil.get_terminal_size().columns - 2)
File "/Users/rapsealk/Desktop/git/backend.ai-dev2/dist/export/python/virtualenvs/python-default/3.11.6/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rapsealk/Desktop/git/backend.ai-dev2/src/ai/backend/cli/extensions.py", line 25, in main
    super().main(
File "/Users/rapsealk/Desktop/git/backend.ai-dev2/dist/export/python/virtualenvs/python-default/3.11.6/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
        ^^^^^^^^^^^^^^^^
File "/Users/rapsealk/Desktop/git/backend.ai-dev2/dist/export/python/virtualenvs/python-default/3.11.6/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rapsealk/Desktop/git/backend.ai-dev2/dist/export/python/virtualenvs/python-default/3.11.6/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rapsealk/Desktop/git/backend.ai-dev2/dist/export/python/virtualenvs/python-default/3.11.6/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rapsealk/Desktop/git/backend.ai-dev2/dist/export/python/virtualenvs/python-default/3.11.6/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: _create_from_template_cmd.<locals>.create_from_template() got an unexpected keyword argument 'type'

Tested with session template below:

---
template:
  api_version: '6'
  kind: taskTemplate
  metadata:
    name: mount-template-v1
  spec:
    sessionType: batch
    kernel:
      image: cr.backend.ai/multiarch/python:3.10-ubuntu20.04
      architecture: aarch64
      environ:
        MYCONFIG: XXX
    scaling_group: default
    mounts:
      vf-0: /home/work/target
    resources:
      cpu: '1'
      mem: 1g

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Mention to the original issue
  • Installer updates including:
    • Fixtures for db schema changes
    • New mandatory config options
  • Update of end-to-end CLI integration tests in ai.backend.test
  • API server-client counterparts (e.g., manager API -> client SDK)
  • Test case(s) to:
    • Demonstrate the difference of before/after
    • Demonstrate the flow of abstract/conceptual models with a concrete implementation
  • Documentation
    • Contents in the docs directory
    • docstrings in public interfaces and type annotations

@rapsealk rapsealk added the type:bug Reports about that are not working label Feb 6, 2024
@rapsealk rapsealk added this to the 23.09 milestone Feb 6, 2024
@rapsealk rapsealk self-assigned this Feb 6, 2024
@rapsealk rapsealk changed the title fix:session create-from-template command is malfunctioning fix: session create-from-template command is malfunctioning Feb 6, 2024
@github-actions github-actions bot added comp:client Related to Client component size:XS ~10 LoC labels Feb 6, 2024
@github-actions github-actions bot added comp:manager Related to Manager component size:L 100~500 LoC and removed size:XS ~10 LoC labels Feb 6, 2024
@rapsealk rapsealk changed the title fix: session create-from-template command is malfunctioning fix: Reorganize click.option decorators in the session create-from-template command Feb 6, 2024
@rapsealk rapsealk marked this pull request as ready for review February 6, 2024 08:27
@rapsealk rapsealk requested review from achimnol and Yaminyam and removed request for achimnol February 6, 2024 08:27
@achimnol achimnol enabled auto-merge February 28, 2024 01:55
@achimnol achimnol added this pull request to the merge queue Feb 28, 2024
Merged via the queue into main with commit c95d44a Feb 28, 2024
26 checks passed
@achimnol achimnol deleted the fix/session-create-from-template-none-undefined branch February 28, 2024 02:02
achimnol added a commit that referenced this pull request Feb 28, 2024
…-template` command (#1890)

Backported-from: main (24.03)
Backported-to: 23.09
Co-authored-by: Joongi Kim <joongi@lablup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:client Related to Client component comp:manager Related to Manager component size:L 100~500 LoC type:bug Reports about that are not working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants