Skip to content

Commit

Permalink
Making round robin task scheduling as an option for dry_run. All wait…
Browse files Browse the repository at this point in the history
…ing tasks are returned if dry_run is false.
  • Loading branch information
aspiringmind-code authored Sep 4, 2024
1 parent 09a9b1d commit 9dc6382
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/python/TaskWorker/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def main():
configuration = loadConfigurationFile(os.path.abspath(options.config))
configuration.section_('Adhoc')
configuration.Adhoc.selection_limit = 10
configuration.Adhoc.dry_run= True
configuration.Adhoc.dry_run= False
status, msg = validateConfig(configuration)
if not status:
raise ConfigException(msg)
Expand Down
12 changes: 7 additions & 5 deletions src/python/TaskWorker/MasterWorker.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def _externalScheduling(self, limit):
External scheduling method using round-robin algorithm to get tasks
in waiting status and consider resource utilization for fair share.
"""
self.logger.info("Starting external scheduling with round-robin algorithm.")
self.logger.info("Starting external scheduling.")

try:
# Retrieve tasks with 'WAITING' status
Expand Down Expand Up @@ -287,11 +287,13 @@ def _externalScheduling(self, limit):
else:
task_count[username] = 1

if self.config.Adhoc.dry_run:
for username, count in task_count.items():
self.logger.info('%d tasks for %s were selected during task scheduling.', count, username)
for username, count in task_count.items():
self.logger.info('%d tasks for %s would have been selected if you had used task scheduling (Available in dry_run).', count, username)

return selected_tasks
if self.config.Adhoc.dry_run:
return selected_tasks #dry_run True (with Task Scheduling)
else:
return waiting_tasks #dry_run False (without Task Scheduling)

except Exception as e:
self.logger.exception("Exception occurred during external scheduling: %s", str(e))
Expand Down

0 comments on commit 9dc6382

Please sign in to comment.