Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion augur/application/cli/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
Augur library commands for controlling the backend components
"""

import os

Check warning on line 7 in augur/application/cli/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0611: Unused import os (unused-import) Raw Output: augur/application/cli/tasks.py:7:0: W0611: Unused import os (unused-import)
import click
import subprocess
import uuid
import time
# from redis.exceptions import ConnectionError as RedisConnectionError

from augur import instance_id

Check warning on line 14 in augur/application/cli/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0611: Unused instance_id imported from augur (unused-import) Raw Output: augur/application/cli/tasks.py:14:0: W0611: Unused instance_id imported from augur (unused-import)
from augur.application.logs import AugurLogger
from augur.application.cli import test_connection, test_db_connection
from augur.application.cli.backend import clear_rabbitmq_messages, raise_open_file_limit
from augur.tasks.start_tasks import trigger_ml_phase

logger = AugurLogger("augur", reset_logfiles=False).get_logger()

Expand Down Expand Up @@ -60,7 +61,7 @@
secondary_worker_process.terminate()

try:
clear_rabbitmq_messages()

Check warning on line 64 in augur/application/cli/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 E1120: No value for argument 'connection_string' in function call (no-value-for-parameter) Raw Output: augur/application/cli/tasks.py:64:12: E1120: No value for argument 'connection_string' in function call (no-value-for-parameter)

except Exception as e:
pass
Expand Down Expand Up @@ -91,4 +92,13 @@
else:
logger.error("Invalid input")



@cli.command("trigger-ml")
@test_connection
@test_db_connection
def trigger_ml():
logger.info("Starting ML tasks")
trigger_ml_phase.delay()
logger.info("ML tasks started")
Comment on lines +100 to +102
Copy link
Contributor

Choose a reason for hiding this comment

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

If the ml workers are not enabled in the config, this will still print a message saying they were started - this seems like it could very easily be confusing



25 changes: 21 additions & 4 deletions augur/tasks/start_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,27 @@
request.get_valid_repos(session)
return request

@celery.task(bind=True)
def trigger_ml_phase(self):
engine = self.app.engine
logger = logging.getLogger(trigger_ml_phase.__name__)
enabled_phase_names = get_enabled_phase_names_from_config(engine, logger)

if RUNNING_DOCKER or machine_learning_phase.__name__ not in enabled_phase_names:
Copy link
Contributor

Choose a reason for hiding this comment

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

why is docker being excluded here?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh i see, because it was excluded in the original logic

return


with DatabaseSession(logger, engine) as session:
config = AugurConfig(logger, session)
ml_phase_request = []
ml_interval = config.get_value('Tasks', 'ml_collection_interval_days') or 40
ml_phase_request.append(build_ml_repo_collect_request(session, logger, enabled_phase_names, ml_interval))

main_routine = AugurTaskRoutine(logger, ml_phase_request)
Copy link
Contributor

Choose a reason for hiding this comment

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

Im not sure if creating a new instance of the augur task routine here could lead to issues or not, especially since we already have one


main_routine.start_data_collection()


@celery.task(bind=True)
def augur_collection_monitor(self):

Expand Down Expand Up @@ -271,10 +292,6 @@
#start_facade_collection(session, max_repo=30)
enabled_collection_hooks.append(build_facade_repo_collect_request(session, logger, enabled_phase_names, facade_interval))

if not RUNNING_DOCKER and machine_learning_phase.__name__ in enabled_phase_names:
enabled_collection_hooks.append(build_ml_repo_collect_request(session, logger, enabled_phase_names, ml_interval))
#start_ml_collection(session,max_repo=5)

logger.info(f"Starting collection phases: {[h.name for h in enabled_collection_hooks]}")

main_routine = AugurTaskRoutine(logger, enabled_collection_hooks)
Expand Down Expand Up @@ -304,7 +321,7 @@
status = repo.collection_status[0]
raw_count = status.issue_pr_sum

issue_pr_task_update_weight_util([int(raw_count)],repo_git=repo_git,session=session)

Check warning on line 324 in augur/tasks/start_tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 E1120: No value for argument 'issue_and_pr_nums' in function call (no-value-for-parameter) Raw Output: augur/tasks/start_tasks.py:324:12: E1120: No value for argument 'issue_and_pr_nums' in function call (no-value-for-parameter)

facade_not_pending = CollectionStatus.facade_status != CollectionState.PENDING.value
facade_not_failed = CollectionStatus.facade_status != CollectionState.FAILED_CLONE.value
Expand Down
Loading