Skip to content

Profilling

save_workflows_profiler_trace(directory, profiler_trace) ΒΆ

Save a workflow profiler trace.

Parameters:

Name Type Description Default
directory str

The directory to save the profiler trace.

required
profiler_trace List[dict]

The profiler trace.

required
Source code in inference_sdk/http/utils/profilling.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def save_workflows_profiler_trace(
    directory: str,
    profiler_trace: List[dict],
) -> None:
    """Save a workflow profiler trace.

    Args:
        directory: The directory to save the profiler trace.
        profiler_trace: The profiler trace.
    """
    directory = os.path.abspath(directory)
    os.makedirs(directory, exist_ok=True)
    formatted_time = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
    track_path = os.path.join(
        directory, f"workflow_execution_tack_{formatted_time}.json"
    )
    with open(track_path, "w") as f:
        json.dump(profiler_trace, f)