Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Komodo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STEVAN Antoine
Komodo
Commits
7b44a886
Verified
Commit
7b44a886
authored
10 months ago
by
STEVAN Antoine
Browse files
Options
Downloads
Patches
Plain Diff
refactor constants from `inbreeding load`
parent
85f60a29
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bins/inbreeding/consts.nu
+4
-0
4 additions, 0 deletions
bins/inbreeding/consts.nu
bins/inbreeding/load.nu
+4
-8
4 additions, 8 deletions
bins/inbreeding/load.nu
with
8 additions
and
8 deletions
bins/inbreeding/consts.nu
+
4
−
0
View file @
7b44a886
export const BIN = "./target/release/inbreeding"
export const CACHE = ($nu.home-path | path join .cache komodo inbreeding)
export const ARG_EXPERIMENT_FORMAT = "{seed}-{env}-{k}-{n}-{nb_bytes}"
export const EXPERIMENT_FORMAT = "{timestamp}-{env}-{strategy}-{k}-{n}-{nb_bytes}"
export const FULL_EXPERIMENT_FORMAT = $"{seed}(char path_sep)($EXPERIMENT_FORMAT)"
This diff is collapsed.
Click to expand it.
bins/inbreeding/load.nu
+
4
−
8
View file @
7b44a886
use consts.nu
use ../../.nushell error "error throw"
const ARG_EXPERIMENT_FORMAT = "{seed}-{env}-{k}-{n}-{nb_bytes}"
const EXPERIMENT_FORMAT = "{timestamp}-{env}-{strategy}-{k}-{n}-{nb_bytes}"
const FULL_EXPERIMENT_FORMAT = $"{seed}(char path_sep)($EXPERIMENT_FORMAT)"
def remove-cache-prefix []: path -> string {
str replace $"($consts.CACHE)(char path_sep)" ''
}
...
...
@@ -17,7 +13,7 @@ def get-experiments []: nothing -> list<string> {
| ls $in
| get name
| each { remove-cache-prefix }
| parse $FULL_EXPERIMENT_FORMAT
| parse $
consts.
FULL_EXPERIMENT_FORMAT
| reject timestamp strategy
| each { values | str join '-' }
| uniq
...
...
@@ -26,11 +22,11 @@ def get-experiments []: nothing -> list<string> {
export def main [
experiment: string@get-experiments,
]: nothing -> table<strategy: string, diversity: table<x: int, y: float, e: float>> {
let exp = $experiment | parse $ARG_EXPERIMENT_FORMAT | into record
let exp = $experiment | parse $
consts.
ARG_EXPERIMENT_FORMAT | into record
if $exp == {} {
error throw {
err: "invalid experiment",
label: $"should have format '($ARG_EXPERIMENT_FORMAT)', found ($experiment)",
label: $"should have format '($
consts.
ARG_EXPERIMENT_FORMAT)', found ($experiment)",
span: (metadata $experiment).span,
}
}
...
...
@@ -54,7 +50,7 @@ export def main [
$experiment_files
| select name
| insert . { get name | remove-cache-prefix | parse $EXPERIMENT_FORMAT }
| insert . { get name | remove-cache-prefix | parse $
consts.
EXPERIMENT_FORMAT }
| flatten --all
| insert diversity {
ls $in.name
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment