Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for import from CSV and import dir #253

Merged

Conversation

JiriPavela
Copy link
Collaborator

Perun import now supports specification of imported profiles through CSV files and allows specifying the import directory.

CLI and CSV interface were extended with the ability to specify custom profile stats.

Resolves #250
Resolves #251

Perun import now supports specification of imported profiles
through CSV files and allows to specify the import directory.

CLI and CSV interface were extended with the ability to specify
custom profile stats.
@JiriPavela JiriPavela force-pushed the feature-generic-profile-stats branch from 9be4d5e to 72c9237 Compare August 7, 2024 14:50
@tfiedor tfiedor self-requested a review August 7, 2024 19:06
Copy link
Collaborator

@tfiedor tfiedor left a comment

Choose a reason for hiding this comment

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

If you need it merge, feel free to merge it, but address my issues in separate PR.

The fixed median aggregation is blocker for me, but it does not need to be fixed in this PR. The rest are minor stuff. If you need consultation regarding this or short call, you can ping me on discord (but after 4pm).

"--exitcode",
"-e",
"--stats-info",
"-t",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why -t?

default="?",
help=("Exit code of the command."),
default=None,
metavar="<stat1-description,...>",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
metavar="<stat1-description,...>",
metavar="[STAT]",

In my WIP I'm rewritting the metavars to conform to [...] notation. Please, use this.

help=("Exit code of the command."),
default=None,
metavar="<stat1-description,...>",
help="Describes the stats associated with the imported profiles. Please see the import "
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be file? If not, change to [STR] and write an example, how, the stats should look.

@dataclass
class ProfileStat:
ALLOWED_ORDERING: ClassVar[dict[str, bool]] = {
"higher_is_better": True,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would consider simplifying to better with type Literal["higher", "lower"]. I could imagine, that there might be case, when there is something different (maybe equal?).

unit: str = "#"
ordering: bool = True
tooltip: str = ""
value: int | float = 0.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

float subsumes int, I would keep float.


# Third-Party Imports
import gzip

# Perun Imports
from perun.collect.kperf import parser
from perun.profile import helpers as profile_helpers
from perun.profile import helpers as p_helpers
Copy link
Collaborator

Choose a reason for hiding this comment

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

If possible, please, don't rename file "owner's" notations. I don't see the saving here.

@@ -66,12 +165,13 @@ def import_from_string(
)
prof.update({"origin": minor_version.checksum})
prof.update({"machine": get_machine_info(machine_info)})
prof.update({"stats": [asdict(stat) for stat in profiles.aggregate_stats(statistics.median)]}),
Copy link
Collaborator

@tfiedor tfiedor Aug 7, 2024

Choose a reason for hiding this comment

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

This definitely should not be fixed to median, there is helper function that does the aggregation and supports more function and is set wrt configure option. Please, rewrite this: the agg parameter should preferably be completely removed and the helper function should be used instead. See https://github.com/Perfexionists/perun/blob/devel/perun/utils/common/common_kit.py#L628 and

default="median",
). Feel free to refactor the selection function so it is more nsync with the code (so it returns function instead of result of application of function; or add another function and maybe it could do some wrapper that would return the function based on the option from aggregate-by key).

@JiriPavela
Copy link
Collaborator Author

Great, thanks for the review, I'll merge it and release it and resolve the issues in a subsequent PR. As for the issue with the fixed median: this is just a temporary solution that we agreed on with Jirka H., so that the CSV import feature is not blocked until a proper (already thoroughly discussed) solution is implemented in the future.

@JiriPavela JiriPavela merged commit a8d2fdc into Perfexionists:devel Aug 8, 2024
17 checks passed
@tfiedor
Copy link
Collaborator

tfiedor commented Aug 8, 2024

Great, thanks for the review, I'll merge it and release it and resolve the issues in a subsequent PR. As for the issue with the fixed median: this is just a temporary solution that we agreed on with Jirka H., so that the CSV import feature is not blocked until a proper (already thoroughly discussed) solution is implemented in the future.

Yeah, I know it is hotfix/workaround, I just wanted to stress that I find this important to be fixed in near future while you are in the context.

@JiriPavela JiriPavela deleted the feature-generic-profile-stats branch August 13, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants