Skip to content

mgr/orch: Make orchestrator interface synchronous. #39352

Merged
sebastian-philipp merged 13 commits intoceph:masterfrom
sebastian-philipp:orch-remove-promise
Mar 2, 2021
Merged

mgr/orch: Make orchestrator interface synchronous. #39352
sebastian-philipp merged 13 commits intoceph:masterfrom
sebastian-philipp:orch-remove-promise

Conversation

@sebastian-philipp
Copy link
Contributor

Only Rook's create_osd function used the old interface. Everything else was redundant by now.

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

time.sleep(0.1)
assert False, "timeout" + str(c._state)
# type: (CephadmOrchestrator, OrchResult) -> Any
return raise_if_exception(c)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this method still need to exist? (Or should it be renamed?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. it's still needed due to the sub-interpreter magic:

def raise_if_exception(c: OrchResult[T]) -> T:
"""
Due to different sub-interpreters, this MUST not be in the `OrchResult` class.
"""
if c.serialized_exception is not None:
try:
e = pickle.loads(c.serialized_exception)
except (KeyError, AttributeError):
raise Exception(c.exception_str)
raise e
assert c.result is not None, 'OrchResult should either have an exception or a result'
return c.result

@sebastian-philipp
Copy link
Contributor Author

2021-02-08 11:08:23,391.391 INFO:__main__:----------------------------------------------------------------------
2021-02-08 11:08:23,391.391 INFO:__main__:Traceback (most recent call last):
2021-02-08 11:08:23,392.392 INFO:__main__:  File "/home/jenkins-build/build/workspace/ceph-api/qa/tasks/mgr/test_module_selftest.py", line 87, in test_orchestrator
2021-02-08 11:08:23,392.392 INFO:__main__:    self._selftest_plugin("orchestrator")
2021-02-08 11:08:23,392.392 INFO:__main__:  File "/home/jenkins-build/build/workspace/ceph-api/qa/tasks/mgr/test_module_selftest.py", line 38, in _selftest_plugin
2021-02-08 11:08:23,392.392 INFO:__main__:    "mgr", "self-test", "module", module_name)
2021-02-08 11:08:23,392.392 INFO:__main__:  File "../qa/tasks/vstart_runner.py", line 1005, in raw_cluster_cmd
2021-02-08 11:08:23,392.392 INFO:__main__:    return self.run_cluster_cmd(**kwargs).stdout.getvalue()
2021-02-08 11:08:23,392.392 INFO:__main__:  File "../qa/tasks/vstart_runner.py", line 995, in run_cluster_cmd
2021-02-08 11:08:23,392.392 INFO:__main__:    return self.controller.run(**kwargs)
2021-02-08 11:08:23,393.393 INFO:__main__:  File "../qa/tasks/vstart_runner.py", line 399, in run
2021-02-08 11:08:23,393.393 INFO:__main__:    return self._do_run(**kwargs)
2021-02-08 11:08:23,393.393 INFO:__main__:  File "../qa/tasks/vstart_runner.py", line 467, in _do_run
2021-02-08 11:08:23,393.393 INFO:__main__:    proc.wait()
2021-02-08 11:08:23,393.393 INFO:__main__:  File "../qa/tasks/vstart_runner.py", line 213, in wait
2021-02-08 11:08:23,393.393 INFO:__main__:    raise CommandFailedError(self.args, self.exitstatus)
2021-02-08 11:08:23,393.393 INFO:__main__:teuthology.exceptions.CommandFailedError: Command failed with status 1: ['./bin/ceph', 'mgr', 'self-test', 'module', 'orchestrator']
2021-02-08 11:08:23,394.394 INFO:__main__:
Cannot find device "ceph-brx"

@sebastian-philipp
Copy link
Contributor Author

I love it rebasing ❤️

image

@sebastian-philipp
Copy link
Contributor Author

sebastian-philipp commented Feb 10, 2021

2021-02-10T04:30:07.501 DEBUG:teuthology.orchestra.run.smithi089:> sudo adjust-ulimits ceph-coverage /home/ubuntu/cephtest/archive/coverage timeout 120 ceph --cluster ceph orch set backend test_orchestrator
2021-02-10T04:30:07.817 DEBUG:teuthology.orchestra.run.smithi089:> sudo adjust-ulimits ceph-coverage /home/ubuntu/cephtest/archive/coverage timeout 120 ceph --cluster ceph orch host rm hostname
2021-02-10T04:30:08.107 INFO:tasks.ceph.mgr.x.smithi089.stderr:2021-02-10T04:30:08.106+0000 7f74d420f700 -1 mgr handle_command module 'orchestrator' command handler threw exception: OrchResult should either have an exception or a result
2021-02-10T04:30:08.107 INFO:tasks.ceph.mgr.x.smithi089.stderr:2021-02-10T04:30:08.107+0000 7f74d420f700 -1 mgr.server reply reply (22) Invalid argument Traceback (most recent call last):
2021-02-10T04:30:08.107 INFO:tasks.ceph.mgr.x.smithi089.stderr:  File "/usr/share/ceph/mgr/mgr_module.py", line 1319, in _handle_command
2021-02-10T04:30:08.107 INFO:tasks.ceph.mgr.x.smithi089.stderr:    return self.handle_command(inbuf, cmd)
2021-02-10T04:30:08.107 INFO:tasks.ceph.mgr.x.smithi089.stderr:  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 167, in handle_command
2021-02-10T04:30:08.107 INFO:tasks.ceph.mgr.x.smithi089.stderr:    return dispatch[cmd['prefix']].call(self, cmd, inbuf)
2021-02-10T04:30:08.107 INFO:tasks.ceph.mgr.x.smithi089.stderr:  File "/usr/share/ceph/mgr/mgr_module.py", line 389, in call
2021-02-10T04:30:08.107 INFO:tasks.ceph.mgr.x.smithi089.stderr:    return self.func(mgr, **kwargs)
2021-02-10T04:30:08.107 INFO:tasks.ceph.mgr.x.smithi089.stderr:  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 108, in <lambda>
2021-02-10T04:30:08.107 INFO:tasks.ceph.mgr.x.smithi089.stderr:    wrapper_copy = lambda *l_args, **l_kwargs: wrapper(*l_args, **l_kwargs)
2021-02-10T04:30:08.107 INFO:tasks.ceph.mgr.x.smithi089.stderr:  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 97, in wrapper
2021-02-10T04:30:08.108 INFO:tasks.ceph.mgr.x.smithi089.stderr:    return func(*args, **kwargs)
2021-02-10T04:30:08.108 INFO:tasks.ceph.mgr.x.smithi089.stderr:  File "/usr/share/ceph/mgr/orchestrator/module.py", line 335, in _remove_host
2021-02-10T04:30:08.108 INFO:tasks.ceph.mgr.x.smithi089.stderr:    raise_if_exception(completion)
2021-02-10T04:30:08.108 INFO:tasks.ceph.mgr.x.smithi089.stderr:  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 225, in raise_if_exception
2021-02-10T04:30:08.108 INFO:tasks.ceph.mgr.x.smithi089.stderr:    assert c.result is not None, 'OrchResult should either have an exception or a result'
2021-02-10T04:30:08.108 INFO:tasks.ceph.mgr.x.smithi089.stderr:AssertionError: OrchResult should either have an exception or a result
ERROR: /home/jenkins-build/build/workspace/ceph-pull-requests/src/pybind/mgr/dashboard/services/orchestrator.py Imports are incorrectly sorted and/or formatted.
Skipped 2 files
ERROR: InvocationError for command /home/jenkins-build/build/workspace/ceph-pull-requests/src/pybind/mgr/dashboard/.tox/lint/bin/isort . --check (exited with code 1)
2021-02-10T04:56:48.519 DEBUG:teuthology.orchestra.run.smithi002:> sudo adjust-ulimits ceph-coverage /home/ubuntu/cephtest/archive/coverage timeout 120 ceph --cluster ceph nfs cluster create cephfs test
2021-02-10T04:56:50.523 INFO:teuthology.orchestra.run.smithi002.stderr:Error EPERM: 'Module' object has no attribute '_orchestrator_wait'
2021-02-10T04:56:50.526 DEBUG:teuthology.orchestra.run:got remote process result: 1

@sebastian-philipp
Copy link
Contributor Author

jenkins test make check

@github-actions
Copy link

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

Copy link
Contributor

@varshar16 varshar16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following changes are nice to have. Otherwise looks good.

Comment on lines 811 to 813
raise_if_exception(completion)
report = completion.result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

report = raise_if_exception(completion)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to keep the changes to the interface limited. Follow-up might be to rename raise_if_exception to get_orch_result() or something.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested because you made similar changes in _list_services(). If you are planning for follow-up PR then it is fine.

@@ -20,41 +20,7 @@
from mgr_module import MgrModule

import orchestrator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would blow-up the diff with unrelated changes.


return wrapper
return inner
from orchestrator import handle_orch_error, raise_if_exception
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead update the import here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to avoid introducing unrelated changes

Copy link
Contributor

@varshar16 varshar16 Mar 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you are importing from orchestrator module here again, I suggested the change. If you don't plan do it then at least add a note to clean up later.

Comment on lines +436 to 447
c = orchestrator.OrchResult(result=None, exception=ZeroDivisionError('hello, world'))
return c
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too

return orchestrator.OrchResult(result=None, exception=ZeroDivisionError('hello, world'))

Comment on lines 30 to 31
completion = mgr.describe_service(service_type='nfs')
mgr._orchestrator_wait([completion])
orchestrator.raise_if_exception(completion)
return [cluster.spec.service_id for cluster in completion.result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result = orchestrator.raise_if_exception(completion)

Comment on lines 747 to 743
completion = self.mgr.list_daemons(daemon_type='nfs')
self.mgr._orchestrator_wait([completion])
orchestrator.raise_if_exception(completion)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nfs_daemon_ls = orchestrator.raise_if_exception(completion)

self.mgr._orchestrator_wait([completion])
orchestrator.raise_if_exception(completion)
host_ip = []
# Here completion.result is a list DaemonDescription objects
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update here as well

@github-actions
Copy link

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

Greatly simplify the orchestrator interface

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Fixes: f69abe6
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Copy link
Contributor

@varshar16 varshar16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but follow-up PR is required for some of the changes.

@sebastian-philipp
Copy link
Contributor Author

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants