Skip to content

Commit

Permalink
fix rebasing, fix running locally
Browse files Browse the repository at this point in the history
  • Loading branch information
ytausch committed Nov 11, 2024
1 parent 813ff9e commit 400b1c0
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions conda_forge_tick/auto_tick.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@
from conda_forge_tick.feedstock_parser import BOOTSTRAP_MAPPINGS
from conda_forge_tick.git_utils import (
DryRunBackend,
DuplicatePullRequestError,
GitCli,
GitCliError,
GitPlatformBackend,
RepositoryNotFoundError,
github_backend,
is_github_api_limit_reached,
is_github_api_limit_reached, DuplicatePullRequestError,
)
from conda_forge_tick.lazy_json_backends import (
LazyJson,
Expand All @@ -51,8 +50,7 @@
PR_LIMIT,
load_migrators,
)
from conda_forge_tick.migration_runner import run_migration
from conda_forge_tick.migrators import MigrationYaml, Migrator, Version
from conda_forge_tick.migrators import Migrator, Version, MigrationYaml
from conda_forge_tick.migrators.version import VersionMigrationError
from conda_forge_tick.os_utils import eval_cmd
from conda_forge_tick.rerender_feedstock import rerender_feedstock
Expand All @@ -69,6 +67,7 @@
load_existing_graph,
sanitize_string,
)
from .migration_runner import run_migration

from .migrators_types import MigrationUidTypedDict
from .models.pr_json import PullRequestData, PullRequestInfoSpecial, PullRequestState
Expand Down Expand Up @@ -849,10 +848,11 @@ def _run_migrator_on_feedstock_branch(
return good_prs, break_loop


def _is_migrator_done(_mg_start, good_prs, time_per, pr_limit):
def _is_migrator_done(
_mg_start, good_prs, time_per, pr_limit, git_backend: GitPlatformBackend
):
curr_time = time.time()
backend = github_backend()
api_req = backend.get_api_requests_left()
api_req = git_backend.get_api_requests_left()

if curr_time - START_TIME > TIMEOUT:
logger.info(
Expand Down Expand Up @@ -930,7 +930,7 @@ def _run_migrator(

if package:
if package not in possible_nodes:
logger.warning(
logger.info(
f"Package {package} is not a candidate for migration of {migrator_name}"
)
return 0
Expand Down Expand Up @@ -968,7 +968,9 @@ def _run_migrator(
flush=True,
)

if _is_migrator_done(_mg_start, good_prs, time_per, migrator.pr_limit):
if _is_migrator_done(
_mg_start, good_prs, time_per, migrator.pr_limit, git_backend
):
return 0

for node_name in possible_nodes:
Expand All @@ -985,7 +987,9 @@ def _run_migrator(
):
# Don't let CI timeout, break ahead of the timeout so we make certain
# to write to the repo
if _is_migrator_done(_mg_start, good_prs, time_per, migrator.pr_limit):
if _is_migrator_done(
_mg_start, good_prs, time_per, migrator.pr_limit, git_backend
):
break

base_branches = migrator.get_possible_feedstock_branches(attrs)
Expand Down Expand Up @@ -1334,7 +1338,7 @@ def main(ctx: CliContext, package: str | None = None) -> None:

for mg_ind, migrator in enumerate(migrators):
good_prs = _run_migrator(
migrator, mctx, temp, time_per_migrator[mg_ind], git_backend
migrator, mctx, temp, time_per_migrator[mg_ind], git_backend, package
)
if good_prs > 0:
pass
Expand All @@ -1349,5 +1353,5 @@ def main(ctx: CliContext, package: str | None = None) -> None:
# ],
# )

logger.info("API Calls Remaining: %d", github_backend().get_api_requests_left())
logger.info(f"API Calls Remaining: {git_backend.get_api_requests_left()}")
logger.info("Done")

0 comments on commit 400b1c0

Please sign in to comment.