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

Return profile after loading from kbatch url #60

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rodolfodalbuquerque
Copy link

While trying to use profiles I successfully loaded profiles onto kbatch_proxy, but got an error when trying to submit a job referencing the profile name.
ex:
kbatch job submit -f .\test-job.yaml --profile="python"

I got the following error:

[18:23:03] INFO     HTTP Request: GET https://bbmplanetarycomputerhub.westeurope.cloudapp.azure.com/services/kbatch/profiles/ "HTTP/1.1 200 OK"                                                         _client.py:1027Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Python311\Scripts\kbatch.exe\__main__.py", line 7, in <module>    
  File "C:\Python311\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\kbatch\cli.py", line 281, in submit_job
    result = _core.submit_job(
             ^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\kbatch\_core.py", line 153, in submit_job
    data = make_job(job, profile=profile).to_dict()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\kbatch\_backend.py", line 242, in make_job
    job_spec = _make_job_spec(job, profile, labels, annotations)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\kbatch\_backend.py", line 89, in _make_job_spec
    resources = profile.get("resources", {})
                ^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get'

after looking at the code, I noticed that loaded profile was never returned from _core._prep_job_data so the profile variable was just "python" instead of the full python profile as a dict.

Maybe I missed something but with these changes I got it working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant