Skip to content

refactor: multiprocessing helper testing codecov#225

Closed
NguyenHoangSon96 wants to merge 4 commits into
mainfrom
refactor/multiprocessing-helper-test
Closed

refactor: multiprocessing helper testing codecov#225
NguyenHoangSon96 wants to merge 4 commits into
mainfrom
refactor/multiprocessing-helper-test

Conversation

@NguyenHoangSon96

Copy link
Copy Markdown
Contributor

Closes #

Proposed Changes

Briefly describe your proposed changes:

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • Tests pass
  • Commit messages are conventional
  • Sign CLA (if not already signed)

@NguyenHoangSon96 NguyenHoangSon96 self-assigned this Jul 23, 2026
Copilot AI review requested due to automatic review settings July 23, 2026 08:23
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.65%. Comparing base (b24d6c1) to head (3c0b6a2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #225      +/-   ##
==========================================
- Coverage   87.21%   86.65%   -0.56%     
==========================================
  Files          28       28              
  Lines        2072     2068       -4     
==========================================
- Hits         1807     1792      -15     
- Misses        265      276      +11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@NguyenHoangSon96 NguyenHoangSon96 changed the title refactor: multiprocessing helper refactor: multiprocessing helper testing codecov Jul 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Refactors the MultiprocessingWriter helper to manage an internal multiprocessing process/context directly (rather than subclassing multiprocessing.Process), and updates integration tests and coverage configuration to support/validate multiprocessing start-method behavior.

Changes:

  • Refactor MultiprocessingWriter to create/manage its own process via multiprocessing.get_context(start_method) and ctx.Process(target=...).
  • Expand integration tests to validate multiprocessing start methods (spawn, forkserver, fork) and adjust the existing multiprocessing helper test.
  • Add Coverage.py multiprocessing concurrency configuration in pyproject.toml, and document the refactor in CHANGELOG.md.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
tests/test_influxdb_client_3_integration.py Updates and expands integration tests for multiprocessing helper and start methods.
pyproject.toml Adds Coverage.py multiprocessing concurrency/parallel configuration.
influxdb_client_3/write_client/client/util/multiprocessing_helper.py Refactors multiprocessing writer to manage its own context/process and queue.
CHANGELOG.md Adds release note entry describing the multiprocessing helper refactor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +126 to 129
For more information on how to initialize the writer, see the examples above.

:param kwargs: arguments are passed into ``__init__`` function of ``InfluxDBClient`` and ``write_api``.
:param kwargs: arguments are passed into the `` _ _init__`` function of ``InfluxDBClient`` and ``write_api``.
"""
Comment on lines +140 to 143
For more information on how to pass arguments, see the examples above.

:param kwargs: arguments are passed into ``write`` function of ``WriteApi``
:param kwargs: arguments are passed into the `` write `` function of ``WriteApi``
:return: None
Comment on lines 176 to 179
def start(self) -> None:
"""Start independent process for writing data into InfluxDB."""
super().start()
"""Start an independent process for writing data into InfluxDB."""
self.process.start()
self.__started__ = True
Comment on lines 208 to 214
if self.__started__:
self.queue_.put(_PoisonPill())
self.queue_.join()
self.join()
self.process.join()
self.queue_ = None
self.__started__ = False
self.__disposed__ = True
Comment on lines +361 to 372
self.assertEqual(mp.get_start_processing_method(), 'spawn')
mp.start()

measurement = f'test{random_hex(6)}'.lower()
for x in range(1, 10):
time.sleep(0.2)
writer.write(
for x in range(1, 5):
time.sleep(0.5)
mp.write(
bucket=self.database,
record=f"{measurement},tag=a value=\"number{x}\" {time.time_ns()}"
)
writer.__del__()
mp.__del__()

self.assertEqual(9, len(df))
self.assertEqual(4, len(df))

def test_multiprocessing_start_method_forkserver(self):
) as mp:
self.assertEqual(mp.get_start_processing_method(), 'forkserver')

def test_multiprocessing_start_method_fork(self):
Comment thread CHANGELOG.md
Comment on lines +28 to +30
1. [#222](https://github.com/InfluxCommunity/influxdb3-python/pull/222): Refactor `MultiprocessingWriter` class.
- New Process will be created by using `DefaultContext.Process(target)` to prevent erratic crashes, handle cross-platform code behavior safely, and coordinate complex resource sharing.
- Users can now choose one of the start methods `fork`, `spawn` or `forkserver` when creating new Process. The default will be `spawn`.
@NguyenHoangSon96
NguyenHoangSon96 force-pushed the refactor/multiprocessing-helper-test branch from a8154b8 to c2175a3 Compare July 23, 2026 08:39
@NguyenHoangSon96
NguyenHoangSon96 force-pushed the refactor/multiprocessing-helper-test branch from 806ffa8 to d01d38b Compare July 23, 2026 09:25
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.

2 participants