Skip to content
Merged
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
13 changes: 13 additions & 0 deletions codeflash/tracing/tracing_new_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import threading
import time
from collections import defaultdict
from importlib.util import find_spec
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, ClassVar

Expand Down Expand Up @@ -47,6 +48,17 @@ def __init__(self, code: FakeCode, prior: FakeFrame | None) -> None:
self.f_locals: dict = {}


def patch_ap_scheduler() -> None:
if find_spec("apscheduler"):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had originally used a Try except but accidentally inverted cond when implementing find_spec

import apscheduler.schedulers.background as bg
import apscheduler.schedulers.blocking as bb
from apscheduler.schedulers import base

bg.BackgroundScheduler.start = lambda _, *_a, **_k: None
bb.BlockingScheduler.start = lambda _, *_a, **_k: None
base.BaseScheduler.add_job = lambda _, *_a, **_k: None


# Debug this file by simply adding print statements. This file is not meant to be debugged by the debugger.
class Tracer:
"""Use this class as a 'with' context manager to trace a function call.
Expand Down Expand Up @@ -820,6 +832,7 @@ def runctx(self, cmd: str, global_vars: dict[str, Any], local_vars: dict[str, An
if __name__ == "__main__":
args_dict = json.loads(sys.argv[-1])
sys.argv = sys.argv[1:-1]
patch_ap_scheduler()
if args_dict["module"]:
import runpy

Expand Down
2 changes: 1 addition & 1 deletion codeflash/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# These version placeholders will be replaced by uv-dynamic-versioning during build.
__version__ = "0.17.0"
__version__ = "0.16.7.post46.dev0+444ff121"
Loading