Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
communications-backbone communications-backbone
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 25
    • Issues 25
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Metrics
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Communications Backbone System
  • communications-backbonecommunications-backbone
  • Merge requests
  • !20

Merged
Created 2 years ago by Dan Jones@danjonOwner

Resolve "Use ThreadPoolExecutor in place of ProcessPoolExecutor"

  • Overview 0
  • Commits 3
  • Pipelines 3
  • Changes 1

Closes #40 (closed)

Edited 2 years ago by Dan Jones
  • Dan Jones @danjon changed milestone to %SoAR-2023W09 2 years ago

    changed milestone to %SoAR-2023W09

  • Dan Jones @danjon added Partner::NOC Project::SoAR Status::In Progress bug labels 2 years ago

    added Partner::NOC Project::SoAR Status::In Progress bug labels

  • Dan Jones @danjon added 1 commit 2 years ago

    added 1 commit

    • 3959f6dd - fix: replace process pool with thread pool

    Compare with previous version

  • Dan Jones @danjon added 1 commit 2 years ago

    added 1 commit

    • c64ca37a - fix: calculate thread workers required for clients

    Compare with previous version

  • Dan Jones @danjon added 1 commit 2 years ago

    added 1 commit

    • 204bb35a - fix: don't specify worker count for config watcher

    Compare with previous version

  • Dan Jones @danjon marked this merge request as ready 2 years ago

    marked this merge request as ready

  • James Kirk @jamki approved this merge request 2 years ago

    approved this merge request

  • Dan Jones @danjon merged 2 years ago

    merged

  • Dan Jones @danjon mentioned in commit 808e48be 2 years ago

    mentioned in commit 808e48be

  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
Compare
  • version 2
    c64ca37a
    2 years ago

  • version 1
    3959f6dd
    2 years ago

  • dev (base)

and
  • latest version
    204bb35a
    3 commits, 2 years ago

  • version 2
    c64ca37a
    2 commits, 2 years ago

  • version 1
    3959f6dd
    1 commit, 2 years ago

1 file
+ 12
- 7
Show latest version
    File browser
    Compare changes
soar_bus.py
+ 12
- 7
  • View file @ c64ca37a

  • Edit in single-file editor

  • Edit in Web IDE


Files with large changes are collapsed by default.

Show all unchanged lines Show 20 lines
def update_clients(updated_client_ids):
global RUNNING_CLIENTS
with concurrent.futures.ProcessPoolExecutor() as executor:
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
logging.debug("Old: " + str(RUNNING_CLIENTS))
logging.debug("New: " + str(updated_client_ids))
Show 20 lines Show all unchanged lines Show 20 lines
return running
def main(executor):
def main(clients, executor):
global RUNNING_CLIENTS
logging.info("Starting SOAR bus...")
client_model = ClientModel()
clients = client_model.get()
# publish
thread = executor.submit(publish, "soar-publish", EXCHANGES.get("publish"))
THREADS["soar-publish"] = thread
Show 20 lines Show all unchanged lines Show 20 lines
s.close()
try:
with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor:
main(executor)
client_model = ClientModel()
clients = client_model.get()
client_count = len(clients.keys())
thread_count = (client_count * 2) + 2
logging.debug(f"Running {thread_count} workers for {client_count} clients")
with concurrent.futures.ThreadPoolExecutor(
max_workers=thread_count
) as executor:
main(clients, executor)
except KeyboardInterrupt:
executor.shutdown(wait=False)
Assignee
Dan Jones's avatar
Dan Jones
@danjon
Assign to
0 Reviewers
None
Request review from
SoAR-2023W09
Milestone
SoAR-2023W09 (Past due)
Assign milestone
None
Time tracking
No estimate or time spent
4
Labels
bug Partner::NOC Project::SoAR Status::In Progress
Assign labels
  • No matching results
  • Manage project labels
Lock merge request
Unlocked
2
2 participants
user avatar
user avatar
Reference: communications-backbone-system/communications-backbone!20
Source branch: 40-use-threadpoolexecutor-in-place-of-processpoolexecutor

    0 pending comments