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
6bcb2e13
Commit
6bcb2e13
authored
3 years ago
by
AxelCarayon
Browse files
Options
Downloads
Patches
Plain Diff
ajout des checksums
parent
a7552066
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
reprodExperiment.py
+18
-6
18 additions, 6 deletions
reprodExperiment.py
with
18 additions
and
6 deletions
reprodExperiment.py
+
18
−
6
View file @
6bcb2e13
...
@@ -4,6 +4,7 @@ import subprocess
...
@@ -4,6 +4,7 @@ import subprocess
import
sys
import
sys
from
git
import
repo
from
git
import
repo
import
yaml
import
yaml
import
hashlib
path
=
"
./
"
path
=
"
./
"
...
@@ -49,7 +50,7 @@ def searchForInputFolder() -> None:
...
@@ -49,7 +50,7 @@ def searchForInputFolder() -> None:
global
inputFolder
global
inputFolder
print
(
"
Searching for input folder...
"
)
print
(
"
Searching for input folder...
"
)
if
folderExists
(
"
inputs
"
):
if
folderExists
(
"
inputs
"
):
inputFolder
=
"
inputs
"
inputFolder
=
"
inputs
/
"
print
(
f
"
{
path
}{
inputFolder
}
found !
"
)
print
(
f
"
{
path
}{
inputFolder
}
found !
"
)
else
:
else
:
raise
Exception
(
f
"
{
path
}
/inputs folder does not exist
"
)
raise
Exception
(
f
"
{
path
}
/inputs folder does not exist
"
)
...
@@ -58,7 +59,7 @@ def searchForOutputFolder() -> None:
...
@@ -58,7 +59,7 @@ def searchForOutputFolder() -> None:
global
outputFolder
global
outputFolder
print
(
"
Searching for output folder...
"
)
print
(
"
Searching for output folder...
"
)
if
folderExists
(
"
outputs
"
):
if
folderExists
(
"
outputs
"
):
outputFolder
=
"
outputs
"
outputFolder
=
"
outputs
/
"
print
(
f
"
{
path
}{
outputFolder
}
found !
"
)
print
(
f
"
{
path
}{
outputFolder
}
found !
"
)
else
:
else
:
raise
Exception
(
f
"
{
path
}
/outputs folder does not exist
"
)
raise
Exception
(
f
"
{
path
}
/outputs folder does not exist
"
)
...
@@ -92,7 +93,6 @@ def scanInputFiles() -> None:
...
@@ -92,7 +93,6 @@ def scanInputFiles() -> None:
inputFiles
.
append
(
file
)
inputFiles
.
append
(
file
)
def
scanOutputsGenerated
()
->
None
:
def
scanOutputsGenerated
()
->
None
:
print
(
outputFolder
)
for
file
in
os
.
listdir
(
outputFolder
):
for
file
in
os
.
listdir
(
outputFolder
):
outputFiles
.
append
(
file
)
outputFiles
.
append
(
file
)
...
@@ -103,7 +103,8 @@ def writeInYaml() -> None:
...
@@ -103,7 +103,8 @@ 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
})
print
(
cur_yaml
)
checksums
=
{
"
checksums
"
:
genChecksums
()}
cur_yaml
.
update
(
checksums
)
with
open
(
'
experimentResume.yaml
'
,
'
w
'
)
as
yamlFile
:
with
open
(
'
experimentResume.yaml
'
,
'
w
'
)
as
yamlFile
:
yaml
.
safe_dump
(
cur_yaml
,
yamlFile
)
yaml
.
safe_dump
(
cur_yaml
,
yamlFile
)
...
@@ -111,7 +112,6 @@ def branchExists(branchName) -> bool:
...
@@ -111,7 +112,6 @@ def branchExists(branchName) -> bool:
return
branchName
in
repository
.
references
return
branchName
in
repository
.
references
def
pushBranch
(
version
=
1
)
->
None
:
def
pushBranch
(
version
=
1
)
->
None
:
print
(
experimentName
)
while
(
branchExists
(
f
"
{
experimentName
}
Experiment
{
version
}
"
)):
while
(
branchExists
(
f
"
{
experimentName
}
Experiment
{
version
}
"
)):
version
+=
1
version
+=
1
else
:
else
:
...
@@ -120,7 +120,19 @@ def pushBranch(version=1) -> None:
...
@@ -120,7 +120,19 @@ def pushBranch(version=1) -> None:
repository
.
git
.
commit
(
m
=
f
"
{
experimentName
}
Experiment
{
version
}
"
)
repository
.
git
.
commit
(
m
=
f
"
{
experimentName
}
Experiment
{
version
}
"
)
repository
.
git
.
push
(
'
--set-upstream
'
,
repository
.
remote
().
name
,
f
"
{
experimentName
}
Experiment
{
version
}
"
)
repository
.
git
.
push
(
'
--set-upstream
'
,
repository
.
remote
().
name
,
f
"
{
experimentName
}
Experiment
{
version
}
"
)
repository
.
git
.
checkout
(
experimentName
)
repository
.
git
.
checkout
(
experimentName
)
def
genChecksum
(
file
)
->
str
:
hash_md5
=
hashlib
.
md5
()
with
open
(
file
,
"
rb
"
)
as
f
:
for
chunk
in
iter
(
lambda
:
f
.
read
(
4096
),
b
""
):
hash_md5
.
update
(
chunk
)
return
hash_md5
.
hexdigest
()
def
genChecksums
()
->
list
[
dict
]:
checksums
=
[]
for
file
in
outputFiles
:
checksums
.
append
({
file
:
genChecksum
(
outputFolder
+
file
)})
return
checksums
if
(
__name__
==
"
__main__
"
):
if
(
__name__
==
"
__main__
"
):
if
(
len
(
sys
.
argv
)
<
2
):
if
(
len
(
sys
.
argv
)
<
2
):
...
...
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