profile
Portable timing profile storage for cross-run/machine estimation.
Classes¶
RuleProfile
dataclass
¶
Timing profile for a single rule.
Attributes:
| Name | Type | Description |
|---|---|---|
rule |
str
|
The rule name. |
sample_count |
int
|
Number of executions observed. |
mean_duration |
float
|
Mean duration in seconds. |
std_dev |
float
|
Standard deviation of durations. |
min_duration |
float
|
Minimum observed duration. |
max_duration |
float
|
Maximum observed duration. |
durations |
list[float]
|
Raw duration values for merging. |
timestamps |
list[float]
|
Unix timestamps when each run completed. |
Source code in snakesee/profile.py
Functions¶
from_stats
classmethod
¶
from_stats(stats: RuleTimingStats) -> RuleProfile
Create a RuleProfile from RuleTimingStats.
Source code in snakesee/profile.py
to_stats ¶
to_stats() -> RuleTimingStats
TimingProfile
dataclass
¶
Complete timing profile for a workflow.
Attributes:
| Name | Type | Description |
|---|---|---|
version |
int
|
Profile format version. |
created |
str
|
ISO timestamp when profile was first created. |
updated |
str
|
ISO timestamp when profile was last updated. |
machine |
str | None
|
Optional machine identifier. |
rules |
dict[str, RuleProfile]
|
Dictionary of rule profiles. |
Source code in snakesee/profile.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
Functions¶
create_new
classmethod
¶
create_new(rule_stats: dict[str, RuleTimingStats]) -> TimingProfile
Create a new profile from rule timing stats.
Source code in snakesee/profile.py
merge_with ¶
merge_with(other: TimingProfile) -> TimingProfile
Merge another profile into this one.
Combines durations and timestamps from both profiles, keeping all data for weighted estimation. Updates the 'updated' timestamp.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
TimingProfile
|
Another profile to merge. |
required |
Returns:
| Type | Description |
|---|---|
TimingProfile
|
A new merged profile. |
Source code in snakesee/profile.py
to_rule_stats ¶
to_rule_stats() -> dict[str, RuleTimingStats]
Functions¶
export_profile_from_metadata ¶
export_profile_from_metadata(metadata_dir: Path, output_path: Path | None = None, merge_existing: bool = False) -> TimingProfile
Export a timing profile from Snakemake metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metadata_dir
|
Path
|
Path to .snakemake/metadata/ directory. |
required |
output_path
|
Path | None
|
Path to write the profile. If None, returns without saving. |
None
|
merge_existing
|
bool
|
If True and output_path exists, merge with existing profile. |
False
|
Returns:
| Type | Description |
|---|---|
TimingProfile
|
The created/merged profile. |
Source code in snakesee/profile.py
find_profile ¶
Search for a profile file in the workflow directory and parent directories.
Searches for .snakesee-profile.json in: 1. workflow_dir 2. Parent directories (up to 5 levels)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow_dir
|
Path
|
Starting directory to search from. |
required |
Returns:
| Type | Description |
|---|---|
Path | None
|
Path to the found profile, or None if not found. |
Source code in snakesee/profile.py
load_profile ¶
load_profile(path: Path) -> TimingProfile
Load a timing profile from a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to the profile file. |
required |
Returns:
| Type | Description |
|---|---|
TimingProfile
|
The loaded profile. |
Raises:
| Type | Description |
|---|---|
ProfileNotFoundError
|
If the profile doesn't exist. |
InvalidProfileError
|
If the profile format is invalid. |
Source code in snakesee/profile.py
save_profile ¶
save_profile(profile: TimingProfile, path: Path) -> None
Save a timing profile to a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile
|
TimingProfile
|
The profile to save. |
required |
path
|
Path
|
Path to write the profile to. |
required |