Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(multiprocess): restart child processes if they are not alive #1550

Merged
merged 5 commits into from
Jul 9, 2024

Conversation

gostilovichd
Copy link
Contributor

Description

Restart child processes in MultiProcessor if the child process terminates for any reason. In our case a process was killed by oom-killer and the faststream app stopped processing events from Kafka.

Fixes # (issue number)

#1059

Type of change

Please delete options that are not relevant.

  • Documentation (typos, code examples, or any documentation updates)
  • Bug fix (a non-breaking change that resolves an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a fix or feature that would disrupt existing functionality)
  • This change requires a documentation update

Checklist

  • My code adheres to the style guidelines of this project (scripts/lint.sh shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running scripts/test-cov.sh
  • I have ensured that static analysis tests are passing by running scripts/static-analysis.sh
  • I have included code examples to illustrate the modifications

@Lancetnik Lancetnik added enhancement New feature or request Core Issues related to core FastStream functionality and affects to all brokers labels Jul 9, 2024
Lancetnik
Lancetnik previously approved these changes Jul 9, 2024

self.processes = active_processes

def should_restart(self) -> bool:
Copy link
Member

Choose a reason for hiding this comment

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

Probably we can use smth like not all((p.is_alive() for p in process))? It looks much explicit for me

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 agree, it looks better. Fixed

@gostilovichd gostilovichd force-pushed the feat-multiprocesses-reload branch from 4b56039 to da0b5a9 Compare July 9, 2024 10:58
@Lancetnik
Copy link
Member

Thank you a lot for contribution and for the framework using! Sorry for waiting for so long (I had a vacation this time)

@Lancetnik Lancetnik enabled auto-merge July 9, 2024 11:13
@Lancetnik Lancetnik added this pull request to the merge queue Jul 9, 2024
Merged via the queue into airtai:main with commit e768d8e Jul 9, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Issues related to core FastStream functionality and affects to all brokers enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants