Skip to content

Commit

Permalink
fix: make IndexSearch optimization log reasons why it may refuse to u… (
Browse files Browse the repository at this point in the history
#524)

* fix: make IndexSearch optimization log reasons why it may refuse to use a replacement task

* style: pre-commit.ci auto fixes [...]

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
bhearsum and pre-commit-ci[bot] authored Jun 20, 2024
1 parent cbc9fa5 commit 8ed01ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/taskgraph/optimize/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,17 @@ def should_replace_task(self, task, params, deadline, arg):
# status can be `None` if we're in `testing` mode
# (e.g. test-action-callback)
if not status or status.get("state") in ("exception", "failed"):
logger.debug(
f'not replacing {task["label"]} with {task_id} because it is in failed or exception state'
)
continue

if deadline and datetime.strptime(
status["expires"], self.fmt
) < datetime.strptime(deadline, self.fmt):
logger.debug(
f'not replacing {task["label"]} with {task_id} because it expires before {deadline}'
)
continue

return task_id
Expand Down

0 comments on commit 8ed01ce

Please sign in to comment.