Skip to content

cephadm: use importlib.metadata for querying ceph_iscsi's version - #57685

Merged
adk3798 merged 2 commits into
ceph:mainfrom
tchaikov:replace-pkg_resources-with-importlib
Jun 11, 2024
Merged

adk3798 merged 2 commits into
ceph:mainfrom
tchaikov:replace-pkg_resources-with-importlib

Conversation

@tchaikov

Copy link
Copy Markdown
Contributor

use importlib.metadata for querying ceph_iscsi's version and fallback to
pkg_resources. as the former is only available in Python 3.8, while
the latter is deprecated.

Refs https://tracker.ceph.com/issues/66201

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
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 dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@tchaikov
tchaikov requested a review from a team as a code owner May 23, 2024 23:25
@tchaikov
tchaikov force-pushed the replace-pkg_resources-with-importlib branch from 1a35ec9 to c246b9a Compare May 23, 2024 23:26
Comment thread src/cephadm/cephadmlib/daemons/iscsi.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good idea, but I think that it should be a file level function, as there's very little need for it to be a closure. Something like:

def _python(engine: str, container_id: str, src: str) -> Tuple[str, str, int]:
    ...

@tchaikov tchaikov May 25, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the whole point of creating this helper is to make the caller's life easier, and to reduce the number of parameters, and less repeatings. the reason why i made it a nested function was that it was not supposed to be shared across other functions. and i wanted to make it very clear. but yes, it does not have to be a closure.

i am moving it to a staticmethod, hope this helps.. hmm, i changed accordingly. now i feel bad when reading the new revision. do you insist? if not, i'd keep this way. otherwise i will push the new revision.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't insist. I typically find standalone functions easier to read and reason about, but I won't demand it in this case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thank you John!

@tchaikov
tchaikov force-pushed the replace-pkg_resources-with-importlib branch from c5566f0 to 2c90dc1 Compare May 25, 2024 07:04
@tchaikov

tchaikov commented May 25, 2024 •

Copy link
Copy Markdown
Contributor Author

v2:

  • rebased.
  • reformat to appease black

tchaikov added 2 commits May 26, 2024 11:09
to prepare for a change to use importlib, then fallback to
pkg_resources. as the former is only available in Python 3.8, while
the latter is deprecated.

Refs https://tracker.ceph.com/issues/66201
Signed-off-by: Kefu Chai <[email protected]>
use importlib.metadata for querying ceph_iscsi's version and fallback to
pkg_resources. as the former is only available in Python 3.8, while
the latter is deprecated.

Refs https://tracker.ceph.com/issues/66201
Signed-off-by: Kefu Chai <[email protected]>
@tchaikov
tchaikov force-pushed the replace-pkg_resources-with-importlib branch from 2c90dc1 to cbd4bed Compare May 26, 2024 03:11
@tchaikov

Copy link
Copy Markdown
Contributor Author

jenkins test api

@phlogistonjohn phlogistonjohn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks ok to me

@adk3798

adk3798 commented Jun 11, 2024

Copy link
Copy Markdown
Contributor

https://pulpito.ceph.com/adking-2024-06-10_15:49:42-orch:cephadm-wip-adk-testing-2024-06-10-0759-distro-default-smithi/

failures consisted of

  • 18 in cluster log type failures, still being cleaned up and a known issue
  • 3 failures in the cleanup of rados_api_tests, don't know the tracker number but this is a known issue
  • 2 failures in mds_upgrade_sequence, known issue
  • 1 failure with staggered upgrade while agent is active, known issue
  • lots of dead jobs due to Error reimaging machines: Failed to power on smithiXXX, general lab/teuthology issue unrelated to the PRs in the run

Nothing to block merging for most PRs in the run

@adk3798
adk3798 merged commit ab67e5a into ceph:main Jun 11, 2024
zdover23 added a commit to zdover23/ceph that referenced this pull request Jul 1, 2024
use importlib.metadata for querying ceph_iscsi's version and fallback to
pkg_resources. as the former is only available in Python 3.8, while
the latter is deprecated.

Refs https://tracker.ceph.com/issues/66201

This commit is functionally equivalent to a Reef-targeted backport of
ceph#57685.

Signed-off-by: Zac Dover <[email protected]>
@zdover23

Copy link
Copy Markdown
Contributor

#57970 - Squid backport
#58323 - Reef backport
#58637 - Quincy backport

@tchaikov
tchaikov deleted the replace-pkg_resources-with-importlib branch July 17, 2024 04:22
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