Skip to content

mgr/vol: reuse code to spawn threads - #59847

Merged
rishabh-d-dave merged 2 commits into
ceph:mainfrom
rishabh-d-dave:mgr-vol-spawn-threads
Oct 25, 2024
Merged

rishabh-d-dave merged 2 commits into
ceph:mainfrom
rishabh-d-dave:mgr-vol-spawn-threads

Conversation

@rishabh-d-dave

Copy link
Copy Markdown
Contributor

Same block of code is written twice to spawn threads in async_job.py.
This has already created an inconsistency in naming of threads. Have
a single method for this and use it instead.

This allows not allows reusing code but also reduces such inconsistency.

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

@rishabh-d-dave
rishabh-d-dave requested review from a team and vshankar September 18, 2024 05:31
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

Comment thread src/pybind/mgr/volumes/fs/async_job.py Outdated

def spawn_new_thread(self, suffix):
t_name = f'{self.name_pfx}.{time.time()}.{suffix}'
log.info(f'spawning new thread with name {t_name}')

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.

why are these in info log level? They should be at debug level IMO.

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.

This one is pretty useful bit of information, it should be an info level IMO.

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.

It just tells it's spawning a thread. INFO should be used when you dump something like counters, etc. which helps in understanding how those values change over time.

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 thread name can be pretty useful when going through logs.

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.

Done. PTAL.

@joscollin joscollin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rishabh-d-dave
What's the motivation behind adding the helpers ? (just to understand). They are used only once.

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@rishabh-d-dave What's the motivation behind adding the helpers ? (just to understand). They are used only once.

Not exactly, both helper call the third helper. The idea is to have same code launch threads for the sake of uniformity. Earlier threads names were different.

@github-actions

Copy link
Copy Markdown

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

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

Rebased to resolve the conflict.

@rishabh-d-dave rishabh-d-dave left a comment

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.

Also add log messages for in these helper methods to allow tracking when
and why more threads were spawned.

Signed-off-by: Rishabh Dave <[email protected]>

@vshankar vshankar 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.

If info->debug was the only change and QA run was done, please go ahead and merge.

@rishabh-d-dave
rishabh-d-dave merged commit eb6dbee into ceph:main Oct 25, 2024
@rishabh-d-dave
rishabh-d-dave deleted the mgr-vol-spawn-threads branch October 25, 2024 06:28
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