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

Make requests to web-server in supervisor #184

Merged

Conversation

bklvsky
Copy link
Contributor

@bklvsky bklvsky commented Nov 18, 2024

  • Request tasks at build_node/get_task endpoint from supervisor
  • Remove requesting new task from builders

Resolves: AlmaLinux/build-system#371

@@ -157,13 +169,25 @@ def sigusr_handler(signum, frame):

node_globals.init_supervisors(config)
builders = []
task_queue = queue.Queue()
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, you need to limit queue size to the amount of workers + 1 or just some fixed size that is configurable and do not request for new tasks when it's full

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

)
self.terminated_event.wait(60)
self.__report_active_tasks()
task = self.__request_build_task()
Copy link
Contributor

Choose a reason for hiding this comment

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

If implemented the thing from above, please put check for queue being full here and only call for new task when there are empty slots

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

logging.debug('creating the {0} working directory'.
format(config.working_dir))
logging.debug(
'creating the {0} working directory'.format(config.working_dir)
Copy link
Member

Choose a reason for hiding this comment

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

Not critical, but I'd prefer to use either %-syntax or f-strings when logging stuff - same applies to others around

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, i thought the same but it's everywhere in the old code. maybe i should create a separate task to get rid of this kind of formatting all over the albs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Please create an issue for that

node_graceful_terminated)
builder = BuildNodeBuilder(
config,
i,
Copy link
Member

Choose a reason for hiding this comment

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

Using single char variable names when iterating is fine, however, in this particular use case and for readability purposes, I'd call it thread_num or something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@bklvsky bklvsky force-pushed the refactor_node_web_server_communication branch from 1265be7 to 4890e6d Compare November 19, 2024 14:09
@@ -57,11 +62,13 @@ def __init__(self, config, thread_num, terminated_event,
graceful_terminated_event : threading.Event
Shows, if process got "kill -10" signal.
"""
super(BuildNodeBuilder, self).__init__(name='Builder-{0}'.format(
thread_num))
super(BuildNodeBuilder, self).__init__(
Copy link
Member

Choose a reason for hiding this comment

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

In modern python we can do super().method(arg), see https://docs.python.org/3/library/functions.html#super

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as the above for string formatting, currently it's everywhere in older code. we could do one task for all reformatting to update the codebase

logging.debug('creating the {0} working directory'.
format(config.working_dir))
logging.debug(
'creating the {0} working directory'.format(config.working_dir)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please create an issue for that

)
data = {
'supported_arches': supported_arches,
'excluded_packages': [],
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a reminder, don't forget to change that when #181 would be merged

@anfimovdm anfimovdm merged commit 9829924 into AlmaLinux:master Nov 21, 2024
2 checks passed
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.

Refactor web-server and build-node communication
5 participants