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
15 changes: 14 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@
"sphinx.ext.todo",
"sphinx.ext.intersphinx",
"sphinx_click.ext",
"sphinx_autodoc_typehints",
]

# Add intersphinx mappings for libraries.
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"pandas": ("https://pandas.pydata.org/docs", None),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down Expand Up @@ -185,7 +192,13 @@
),
]

nitpick_ignore = [("py:class", "ModelRecord"), ("py:class", "pandas.DataFrame")]
nitpick_ignore = [
("py:class", "perun.utils.structs.common_structs.ModelRecord"),
("py:class", "perun.utils.common.common_kit.Aggregations"),
("py:class", "TempTextIO"),
("py:class", "polars.lazyframe.frame.LazyFrame"),
("py:class", "pandas.core.frame.DataFrame"), # Needed only for Python 3.10
]


def doctree_read_handler(_, doctree):
Expand Down
2 changes: 1 addition & 1 deletion docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ List of Supported Options
multi-key sort semantics by providing a list of the following attributes specified by the
class attribute ``ProfileInfo.valid_attributes``:

.. currentmodule:: perun.profile.helpers
.. currentmodule:: perun.profiles.native.helpers
.. autoattribute:: ProfileInfo.valid_attributes

.. confkey:: format.sort_profiles_order
Expand Down
53 changes: 47 additions & 6 deletions docs/profile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ to the look-up table should greatly reduce the size of profiles.
Profile API
-----------

.. automodule:: perun.profile.helpers
.. automodule:: perun.profiles.native.helpers

.. automodule:: perun.profile.factory
.. automodule:: perun.profiles.native.factory

.. autoclass:: Profile
:members: all_resources, all_snapshots, all_models, all_filtered_models
Expand All @@ -367,20 +367,46 @@ Profile API
Profile Conversions API
-----------------------

.. automodule:: perun.profile.convert
.. automodule:: perun.profiles.conversions.elk_native

.. autofunction:: import_elk_from_json

.. automodule:: perun.profiles.conversions.folded_polars

.. autofunction:: folded_profiles_to_polars_lf

.. automodule:: perun.profiles.conversions.native_folded

.. autofunction:: native_to_folded

.. automodule:: perun.profiles.conversions.native_pandas

.. autofunction:: resources_to_pandas_dataframe

.. autofunction:: to_flame_graph_format
.. autofunction:: models_to_pandas_dataframe

.. automodule:: perun.profiles.conversions.native_polars

.. autofunction:: native_to_polars_lf

.. automodule:: perun.profiles.conversions.perf_native

.. autofunction:: import_perf_from_record

.. autofunction:: import_perf_from_script

.. autofunction:: plot_data_from_coefficients_of
.. autofunction:: import_perf_from_stack

.. automodule:: perun.profiles.conversions.polars_folded

.. autofunction:: store_polars_as_folded_profile

.. _profile-query-api:

Profile Query API
-----------------

.. automodule:: perun.profile.query
.. automodule:: perun.profiles.native.query

.. autofunction:: all_items_of

Expand All @@ -391,3 +417,18 @@ Profile Query API
.. autofunction:: all_key_values_of

.. autofunction:: unique_model_values_of

Helper Structures
-----------------

.. automodule:: perun.profiles.structs

.. autoclass:: PostprocessParameters

.. autoclass:: ProfileFeatures

.. automodule:: perun.profiles.polars.structs

.. autoclass:: FunctionMaps

.. autoclass:: PolarsTraceProfile
4 changes: 2 additions & 2 deletions perun/check/detection_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Perun Imports
from perun.check.methods import linear_regression, polynomial_regression, fast_check
from perun.postprocess.regression_analysis import regression_models
from perun.profile import query
from perun.profiles.native import query
from perun.utils.common import common_kit
from perun.utils.structs.common_structs import (
PerformanceChange,
Expand All @@ -29,7 +29,7 @@
)

if TYPE_CHECKING:
from perun.profile.factory import Profile
from perun.profiles.native import Profile


SAMPLES: int = 1000
Expand Down
26 changes: 13 additions & 13 deletions perun/check/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
# Third-Party Imports

# Perun Imports
from perun.logic import config, pcs, runner, store
from perun.select.abstract_base_selection import AbstractBaseSelection
from perun.check.methods import (
average_amount_threshold,
best_model_order_equality,
Expand All @@ -26,22 +24,24 @@
local_statistics,
polynomial_regression,
)
from perun.logic import config, pcs, runner, store
from perun.profiles.native import helpers as profile_helpers
from perun.selection.abstract_base_selection import AbstractBaseSelection
import perun.selection.factory as select
from perun.utils import decorators, log
from perun.utils.common import common_kit
from perun.utils.exceptions import UnsupportedModuleException
from perun.utils.structs.common_structs import (
DetectionChangeResult,
DegradationInfo,
PerformanceChange,
MinorVersion,
ModelRecord,
)
from perun.utils.common import common_kit
from perun.utils.exceptions import UnsupportedModuleException
import perun.profile.helpers as profiles
import perun.select.factory as select

if TYPE_CHECKING:
from perun.profile.factory import Profile
from perun.profile.helpers import ProfileInfo
from perun.profiles.native import Profile
from perun.profiles.native.helpers import ProfileInfo

# Minimal confidence rate from both models to perform the detection
_MIN_CONFIDENCE_RATE = 0.15
Expand Down Expand Up @@ -71,7 +71,7 @@ def profiles_to_queue(
:param minor_version: minor version for which we are retrieving the profile queue
:returns: dictionary mapping configurations of profiles to the actual profiles
"""
minor_version_profiles = profiles.load_list_for_minor_version(minor_version)
minor_version_profiles = profile_helpers.load_list_for_minor_version(minor_version)
return {profile.config_tuple: profile for profile in minor_version_profiles}


Expand Down Expand Up @@ -133,7 +133,7 @@ def degradation_in_minor(
for target_config, target_profile_info in profile_queue.items():
# Iterate through the profiles and check degradation between those of same configuration
target_prof = store.load_profile_from_file(target_profile_info.realpath, False, True)
cmdstr = profiles.config_tuple_to_cmdstr(target_config)
cmdstr = profile_helpers.config_tuple_to_cmdstr(target_config)

for baseline_info, baseline_profile_info in selection.get_profiles(
minor_version_info, target_prof
Expand Down Expand Up @@ -262,8 +262,8 @@ def degradation_between_files(
"""
log.major_info("Checking two compatible profiles")
# First check if the configurations are compatible
baseline_config = profiles.to_config_tuple(baseline_file)
target_config = profiles.to_config_tuple(target_file)
baseline_config = profile_helpers.to_config_tuple(baseline_file)
target_config = profile_helpers.to_config_tuple(target_file)
target_minor_version = target_file.get("origin", minor_version)
if not force:
if baseline_config != target_config:
Expand All @@ -276,7 +276,7 @@ def degradation_between_files(
for deg in degradation_between_profiles(baseline_file, target_file, models_strategy):
if deg.result != PerformanceChange.NoChange:
detected_changes.append(
(deg, profiles.config_tuple_to_cmdstr(baseline_config), target_minor_version)
(deg, profile_helpers.config_tuple_to_cmdstr(baseline_config), target_minor_version)
)

# Store the detected changes for given minor version
Expand Down
2 changes: 1 addition & 1 deletion perun/check/methods/abstract_base_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# Perun Imports
if TYPE_CHECKING:
from perun.profile.factory import Profile
from perun.profiles.native import Profile
from perun.utils.structs.common_structs import DegradationInfo


Expand Down
7 changes: 4 additions & 3 deletions perun/check/methods/average_amount_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@

# Perun Imports
from perun.check.methods.abstract_base_checker import AbstractBaseChecker
from perun.profile import convert
from perun.profiles.conversions import native_pandas
from perun.utils.common import common_kit
from perun.utils.structs.common_structs import DegradationInfo, PerformanceChange

if TYPE_CHECKING:
from perun.profile.factory import Profile
from perun.profiles.native import Profile


DEGRADATION_THRESHOLD = 2.0
OPTIMIZATION_THRESHOLD = 0.5
Expand All @@ -61,7 +62,7 @@ def get_averages(profile: Profile) -> dict[str, float]:
:param profile: dictionary representation of profile
:returns: dictionary with averages for all uids
"""
data_frame = convert.resources_to_pandas_dataframe(profile)
data_frame = native_pandas.resources_to_pandas_dataframe(profile)
# Short fix for non-measured (static) profiles
if "amount" not in data_frame:
data_frame["amount"] = 0
Expand Down
2 changes: 1 addition & 1 deletion perun/check/methods/best_model_order_equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
from perun.utils.structs.common_structs import DegradationInfo, PerformanceChange

if TYPE_CHECKING:
from perun.profile.factory import Profile
from perun.profiles.native import Profile


CONFIDENCE_THRESHOLD = 0.9
Expand Down
9 changes: 5 additions & 4 deletions perun/check/methods/exclusive_time_outliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
from __future__ import annotations

# Standard Imports
from typing import Optional, Iterable, Any, TYPE_CHECKING
from typing import Any, Iterable, Optional, TYPE_CHECKING

# Third-Party Imports
import difflib
Expand All @@ -78,11 +78,12 @@
# Perun Imports
from perun.check.methods.abstract_base_checker import AbstractBaseChecker
from perun.logic import config
from perun.profile import convert
from perun.profiles.conversions import native_pandas
from perun.utils.structs.common_structs import DegradationInfo, PerformanceChange

if TYPE_CHECKING:
from perun.profile.factory import Profile
from perun.profiles.native import Profile


OldLocMap = dict[str, str]
NewLocMap = dict[str, str]
Expand Down Expand Up @@ -366,7 +367,7 @@ def _prepare_profile(self, profile: Profile) -> pd.DataFrame:
# Obtain "Uid (function name), exclusive time, location" DataFrame
# and sum the exclusive times of individual functions
df = (
convert.resources_to_pandas_dataframe(profile)[columns]
native_pandas.resources_to_pandas_dataframe(profile)[columns]
.groupby(["uid", "location"])
.sum()
.reset_index()
Expand Down
2 changes: 1 addition & 1 deletion perun/check/methods/fast_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from perun.utils.structs.common_structs import DegradationInfo, ClassificationMethod

if TYPE_CHECKING:
from perun.profile.factory import Profile
from perun.profiles.native import Profile


class FastCheck(AbstractBaseChecker):
Expand Down
2 changes: 1 addition & 1 deletion perun/check/methods/integral_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from perun.utils.structs.common_structs import DegradationInfo, ModelRecord, DetectionChangeResult

if TYPE_CHECKING:
from perun.profile.factory import Profile
from perun.profiles.native import Profile


# acceptable value of relative error between compared profiles to detect NO_CHANGE state
Expand Down
2 changes: 1 addition & 1 deletion perun/check/methods/linear_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import numpy
import numpy.typing as npt

from perun.profile.factory import Profile
from perun.profiles.native import Profile


class LinearRegression(AbstractBaseChecker):
Expand Down
2 changes: 1 addition & 1 deletion perun/check/methods/local_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Perun Imports
from perun import check as check
from perun.check.methods.abstract_base_checker import AbstractBaseChecker
from perun.profile.factory import Profile
from perun.profiles.native import Profile
from perun.utils.common import common_kit
from perun.utils.structs.common_structs import DegradationInfo, ModelRecord, DetectionChangeResult

Expand Down
2 changes: 1 addition & 1 deletion perun/check/methods/polynomial_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if TYPE_CHECKING:
import numpy.typing as npt

from perun.profile.factory import Profile
from perun.profiles.native import Profile

THRESHOLD = 100000000

Expand Down
2 changes: 1 addition & 1 deletion perun/check/nonparam_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import perun.postprocess.regressogram.methods as rg_methods

if TYPE_CHECKING:
from perun.profile.factory import Profile
from perun.profiles.native import Profile


def classify_change(
Expand Down
2 changes: 1 addition & 1 deletion perun/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
import perun.deltadebugging.factory as delta

if TYPE_CHECKING:
from perun.profile.factory import Profile
from perun.profiles.native import Profile


DEV_MODE = False
Expand Down
2 changes: 1 addition & 1 deletion perun/cli_groups/check_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from perun.utils.structs import check_structs

if TYPE_CHECKING:
from perun.profile.factory import Profile
from perun.profiles.native import Profile


@click.group("check")
Expand Down
4 changes: 2 additions & 2 deletions perun/cli_groups/collect_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Perun Imports
from perun.utils.structs import collect_structs
from perun.utils.common import cli_kit
from perun import profile
from perun.profiles.native import helpers as profile_helpers
from perun.logic import commands, config as perun_config


Expand Down Expand Up @@ -208,7 +208,7 @@ def collect(ctx: click.Context, **kwargs: Any) -> None:
``perun run job --help``.
"""
commands.try_init()
kwargs["profile_path"] = profile.ProfilePath(
kwargs["profile_path"] = profile_helpers.ProfilePath(
kwargs.get("profile_name"), kwargs.get("profile_dir")
)
ctx.obj = kwargs
Loading
Loading