Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
catalog
Tools
Commits
68af4ce1
Commit
68af4ce1
authored
1 year ago
by
Florian Ziemen
Browse files
Options
Downloads
Patches
Plain Diff
basic experiment type -- still very rough
parent
6e7879c7
No related branches found
No related tags found
No related merge requests found
Pipeline
#53474
passed with warnings
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
experiment.py
+39
-0
39 additions, 0 deletions
experiment.py
test_experiment.py
+71
-0
71 additions, 0 deletions
test_experiment.py
with
110 additions
and
0 deletions
experiment.py
0 → 100644
+
39
−
0
View file @
68af4ce1
from
collections.abc
import
Sequence
from
dataclasses
import
dataclass
from
dataset
import
dataset
@dataclass
class
model_setup
:
git_repo
:
str
commit_id
:
str
@dataclass
class
icon_setup
(
model_setup
):
configure_command
:
str
config
:
str
host
:
str
@dataclass
class
experiment
:
experiment_id
:
str
model
:
str
setup
:
model_setup
point_of_contact
:
str
copyright_info
:
str
cite_as
:
str
description
:
str
datasets
:
Sequence
[
dataset
]
def
__post_init__
(
self
):
self
.
datasets
=
list
(
self
.
datasets
)
if
not
all
(
isinstance
(
x
,
dataset
)
for
x
in
self
.
datasets
):
raise
TypeError
(
f
"
Datesets must be of type dataset, found
{
[
type
(
x
)
for
x
in
self
.
datasets
]
}
"
)
if
not
isinstance
(
self
.
setup
,
model_setup
):
raise
TypeError
(
f
"
setup must be of type model_setup, found
{
type
(
self
.
setup
)
}
.
"
)
This diff is collapsed.
Click to expand it.
test_experiment.py
0 → 100644
+
71
−
0
View file @
68af4ce1
#!/usr/bin/env python
import
experiment
import
unittest
class
test_experiment
(
unittest
.
TestCase
):
setup
=
experiment
.
icon_setup
(
configure_command
=
"
configure
"
,
config
=
"
sensible
"
,
host
=
"
levante
"
,
git_repo
=
"
gitlab.dkrz.de
"
,
commit_id
=
"
abc123
"
,
)
def
test_experiment
(
self
):
setup
=
experiment
.
icon_setup
(
configure_command
=
"
configure
"
,
config
=
"
sensible
"
,
host
=
"
levante
"
,
git_repo
=
"
gitlab.dkrz.de
"
,
commit_id
=
"
abc123
"
,
)
experiment
.
experiment
(
experiment_id
=
"
test
"
,
model
=
"
icon
"
,
setup
=
setup
,
point_of_contact
=
"
flo
"
,
copyright_info
=
"
cc-by-4.0 Flo
"
,
cite_as
=
"
Flo
"
,
description
=
"
test experiment
"
,
datasets
=
[],
)
def
test_experiment_fail
(
self
):
with
self
.
assertRaises
(
TypeError
):
experiment
.
icon_setup
(
configure_command
=
"
configure
"
,
# config="sensible",
host
=
"
levante
"
,
git_repo
=
"
gitlab.dkrz.de
"
,
commit_id
=
"
abc123
"
,
)
with
self
.
assertRaises
(
TypeError
):
experiment
.
experiment
(
experiment_id
=
"
test
"
,
model
=
"
icon
"
,
setup
=
"
BAD SETUP
"
,
# !
point_of_contact
=
"
flo
"
,
copyright_info
=
"
cc-by-4.0 Flo
"
,
cite_as
=
"
Flo
"
,
description
=
"
test experiment
"
,
datasets
=
[],
)
with
self
.
assertRaises
(
TypeError
):
experiment
.
experiment
(
experiment_id
=
"
test
"
,
model
=
"
icon
"
,
setup
=
test_experiment
.
setup
,
point_of_contact
=
"
flo
"
,
copyright_info
=
"
cc-by-4.0 Flo
"
,
cite_as
=
"
Flo
"
,
description
=
"
test experiment
"
,
datasets
=
(
"
BAD
"
,
"
DATASET
"
),
# !
)
if
__name__
==
"
__main__
"
:
unittest
.
main
()
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