Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
reproductionTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
SMAC
Reproductibilité des recherches dans SMAC
reproductionTool
Commits
314492c2
Commit
314492c2
authored
3 years ago
by
AxelCarayon
Browse files
Options
Downloads
Patches
Plain Diff
Permet à l'utilisateur d'enregistrer un fichier de paramétrage (ou aucun)
parent
0b6d9680
Branches
Branches containing commit
No related tags found
1 merge request
!17
Permet à l'utilisateur d'enregistrer un fichier de paramétrage (ou au…
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
registerExperiment.py
+19
-4
19 additions, 4 deletions
registerExperiment.py
with
19 additions
and
4 deletions
registerExperiment.py
+
19
−
4
View file @
314492c2
...
@@ -16,6 +16,7 @@ inputFolder = None
...
@@ -16,6 +16,7 @@ inputFolder = None
inputFiles
=
[]
inputFiles
=
[]
paramsFolder
=
None
paramsFolder
=
None
paramsFiles
=
[]
commandsFile
=
"
commands.txt
"
commandsFile
=
"
commands.txt
"
...
@@ -75,7 +76,7 @@ def searchForInputFolder() -> None:
...
@@ -75,7 +76,7 @@ def searchForInputFolder() -> None:
if
answer
==
""
:
if
answer
==
""
:
warnings
.
warn
(
"
No input folder given, no input files will be registered
"
)
warnings
.
warn
(
"
No input folder given, no input files will be registered
"
)
else
:
else
:
if
not
folderExists
(
"
inputs
"
):
if
not
folderExists
(
answer
):
raise
Exception
(
f
"
{
path
}
/
{
answer
}
folder does not exist
"
)
raise
Exception
(
f
"
{
path
}
/
{
answer
}
folder does not exist
"
)
else
:
else
:
if
not
answer
.
endswith
(
"
/
"
):
if
not
answer
.
endswith
(
"
/
"
):
...
@@ -97,10 +98,16 @@ def searchForOutputFolder() -> None:
...
@@ -97,10 +98,16 @@ def searchForOutputFolder() -> None:
def
searchForParamsFolder
()
->
None
:
def
searchForParamsFolder
()
->
None
:
global
paramsFolder
global
paramsFolder
if
folderExists
(
"
params
"
):
answer
=
input
(
"
In which folder do you store your parameters ? Give the path from the root of the repository :
"
)
paramsFolder
=
"
params
"
if
answer
==
""
:
warnings
.
warn
(
"
No parameters folder given, no parameters will be registered
"
)
else
:
else
:
raise
Exception
(
f
"
{
path
}
/params folder does not exist
"
)
if
not
folderExists
(
answer
):
raise
Exception
(
f
"
{
path
}
/
{
answer
}
folder does not exist
"
)
else
:
if
not
answer
.
endswith
(
"
/
"
):
answer
+=
"
/
"
paramsFolder
=
answer
def
askForCommandsFile
()
->
None
:
def
askForCommandsFile
()
->
None
:
global
commandsFile
global
commandsFile
...
@@ -147,6 +154,11 @@ def scanOutputsGenerated() -> None:
...
@@ -147,6 +154,11 @@ def scanOutputsGenerated() -> None:
if
not
file
.
endswith
(
"
.gitkeep
"
):
if
not
file
.
endswith
(
"
.gitkeep
"
):
outputFiles
.
append
(
f
"
{
outputFolder
}{
file
}
"
)
outputFiles
.
append
(
f
"
{
outputFolder
}{
file
}
"
)
def
scanParameters
()
->
None
:
for
file
in
os
.
listdir
(
paramsFolder
):
if
not
file
.
endswith
(
"
.gitkeep
"
):
paramsFiles
.
append
(
f
"
{
paramsFolder
}{
file
}
"
)
def
checkGeneratedFiles
()
->
None
:
def
checkGeneratedFiles
()
->
None
:
changesNotAdded
=
[
item
.
a_path
for
item
in
repository
.
index
.
diff
(
None
)
]
changesNotAdded
=
[
item
.
a_path
for
item
in
repository
.
index
.
diff
(
None
)
]
untrackedFiles
=
repository
.
untracked_files
untrackedFiles
=
repository
.
untracked_files
...
@@ -160,6 +172,7 @@ def writeInYaml() -> None:
...
@@ -160,6 +172,7 @@ def writeInYaml() -> None:
cur_yaml
.
update
({
"
commands
"
:
commandsFile
})
cur_yaml
.
update
({
"
commands
"
:
commandsFile
})
cur_yaml
.
update
({
"
inputs
"
:
inputFiles
})
cur_yaml
.
update
({
"
inputs
"
:
inputFiles
})
cur_yaml
.
update
({
"
outputs
"
:
outputFiles
})
cur_yaml
.
update
({
"
outputs
"
:
outputFiles
})
cur_yaml
.
update
({
"
params
"
:
paramsFiles
})
checksums
=
{
"
checksums
"
:
genChecksums
()}
checksums
=
{
"
checksums
"
:
genChecksums
()}
cur_yaml
.
update
(
checksums
)
cur_yaml
.
update
(
checksums
)
with
open
(
'
experimentResume.yaml
'
,
'
w
'
)
as
yamlFile
:
with
open
(
'
experimentResume.yaml
'
,
'
w
'
)
as
yamlFile
:
...
@@ -215,6 +228,8 @@ def run(folder) -> None :
...
@@ -215,6 +228,8 @@ def run(folder) -> None :
scanInputFiles
()
scanInputFiles
()
if
outputFolder
!=
None
:
if
outputFolder
!=
None
:
scanOutputsGenerated
()
scanOutputsGenerated
()
if
paramsFolder
!=
None
:
scanParameters
()
checkGeneratedFiles
()
checkGeneratedFiles
()
writeInYaml
()
writeInYaml
()
pushBranch
()
pushBranch
()
\ No newline at end of file
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