Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CADET-RDM
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IBG-1
ModSim
CADET
CADET-RDM
Commits
7cc87888
Commit
7cc87888
authored
1 year ago
by
Ronald Jäpel
Browse files
Options
Downloads
Patches
Plain Diff
Refactor
parent
7e7036ca
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cadetrdm/cli_integration.py
+0
-1
0 additions, 1 deletion
cadetrdm/cli_integration.py
cadetrdm/repositories.py
+14
-8
14 additions, 8 deletions
cadetrdm/repositories.py
with
14 additions
and
9 deletions
cadetrdm/cli_integration.py
+
0
−
1
View file @
7cc87888
import
shlex
import
subprocess
import
subprocess
import
click
import
click
...
...
This diff is collapsed.
Click to expand it.
cadetrdm/repositories.py
+
14
−
8
View file @
7cc87888
...
@@ -779,24 +779,24 @@ class ProjectRepo(BaseRepo):
...
@@ -779,24 +779,24 @@ class ProjectRepo(BaseRepo):
"
Python sys args
"
:
str
(
sys
.
argv
),
"
Python sys args
"
:
str
(
sys
.
argv
),
"
Tags
"
:
"
,
"
.
join
(
self
.
tags
),
"
Tags
"
:
"
,
"
.
join
(
self
.
tags
),
}
}
c
sv_header
=
"
\t
"
.
join
(
meta_info_dict
.
keys
())
t
sv_header
=
"
\t
"
.
join
(
meta_info_dict
.
keys
())
c
sv_data
=
"
\t
"
.
join
([
str
(
x
)
for
x
in
meta_info_dict
.
values
()])
t
sv_data
=
"
\t
"
.
join
([
str
(
x
)
for
x
in
meta_info_dict
.
values
()])
with
open
(
json_filepath
,
"
w
"
)
as
f
:
with
open
(
json_filepath
,
"
w
"
)
as
f
:
json
.
dump
(
meta_info_dict
,
f
,
indent
=
2
)
json
.
dump
(
meta_info_dict
,
f
,
indent
=
2
)
if
not
tsv_filepath
.
exists
():
if
not
tsv_filepath
.
exists
():
with
open
(
tsv_filepath
,
"
w
"
)
as
f
:
with
open
(
tsv_filepath
,
"
w
"
)
as
f
:
f
.
write
(
c
sv_header
+
"
\n
"
)
f
.
write
(
t
sv_header
+
"
\n
"
)
# csv.writer(
c
sv_header + "\n")
# csv.writer(
t
sv_header + "\n")
with
open
(
tsv_filepath
,
"
r
"
)
as
f
:
with
open
(
tsv_filepath
,
"
r
"
)
as
f
:
existing_header
=
f
.
readline
().
replace
(
"
\n
"
,
""
)
existing_header
=
f
.
readline
().
replace
(
"
\n
"
,
""
)
if
existing_header
!=
c
sv_header
:
if
existing_header
!=
t
sv_header
:
raise
ValueError
(
"
The used structure of the meta_dict doesn
'
t match the header found in log.tsv
"
)
raise
ValueError
(
"
The used structure of the meta_dict doesn
'
t match the header found in log.tsv
"
)
with
open
(
tsv_filepath
,
"
a
"
)
as
f
:
with
open
(
tsv_filepath
,
"
a
"
)
as
f
:
f
.
write
(
c
sv_data
+
"
\n
"
)
f
.
write
(
t
sv_data
+
"
\n
"
)
self
.
dump_package_list
(
logs_folderpath
)
self
.
dump_package_list
(
logs_folderpath
)
...
@@ -882,12 +882,12 @@ class ProjectRepo(BaseRepo):
...
@@ -882,12 +882,12 @@ class ProjectRepo(BaseRepo):
return
file_path
return
file_path
if
branch_name
is
None
and
not
os
.
path
.
exists
(
file_path
):
if
branch_name
is
None
and
not
os
.
path
.
exists
(
file_path
):
branch_name_and_path
=
file_path
.
split
(
"
_cached
"
)[
-
1
]
branch_name_and_path
=
file_path
.
split
(
"
_cached
/
"
)[
-
1
]
if
os
.
sep
not
in
branch_name_and_path
:
if
os
.
sep
not
in
branch_name_and_path
:
sep
=
"
/
"
sep
=
"
/
"
else
:
else
:
sep
=
os
.
sep
sep
=
os
.
sep
branch_name
,
file_path
=
file
_path
.
split
(
sep
,
maxsplit
=
1
)
branch_name
,
file_path
=
branch_name_and
_path
.
split
(
sep
,
maxsplit
=
1
)
if
self
.
output_repo
.
exist_uncomitted_changes
:
if
self
.
output_repo
.
exist_uncomitted_changes
:
self
.
output_repo
.
stash_all_changes
()
self
.
output_repo
.
stash_all_changes
()
...
@@ -1034,6 +1034,7 @@ class ProjectRepo(BaseRepo):
...
@@ -1034,6 +1034,7 @@ class ProjectRepo(BaseRepo):
commit_return
=
self
.
output_repo
.
_git
.
commit
(
"
-m
"
,
message
)
commit_return
=
self
.
output_repo
.
_git
.
commit
(
"
-m
"
,
message
)
self
.
copy_data_to_cache
()
self
.
copy_data_to_cache
()
self
.
update_output_master_logs
()
self
.
update_output_master_logs
()
self
.
copy_data_to_cache
(
"
master
"
)
print
(
"
\n
"
+
commit_return
+
"
\n
"
)
print
(
"
\n
"
+
commit_return
+
"
\n
"
)
except
git
.
exc
.
GitCommandError
as
e
:
except
git
.
exc
.
GitCommandError
as
e
:
self
.
output_repo
.
delete_active_branch_if_branch_is_empty
()
self
.
output_repo
.
delete_active_branch_if_branch_is_empty
()
...
@@ -1063,11 +1064,16 @@ class ProjectRepo(BaseRepo):
...
@@ -1063,11 +1064,16 @@ class ProjectRepo(BaseRepo):
try
:
try
:
yield
new_branch_name
yield
new_branch_name
except
Exception
as
e
:
except
Exception
as
e
:
self
.
capture_error
(
e
)
self
.
output_repo
.
delete_active_branch_if_branch_is_empty
()
self
.
output_repo
.
delete_active_branch_if_branch_is_empty
()
raise
e
raise
e
else
:
else
:
self
.
exit_context
(
message
=
results_commit_message
)
self
.
exit_context
(
message
=
results_commit_message
)
def
capture_error
(
self
,
error
):
print
(
traceback
.
format_exc
())
write_lines_to_file
(
self
.
output_path
/
"
error.stack
"
,
traceback
.
format_exc
())
class
OutputRepo
(
BaseRepo
):
class
OutputRepo
(
BaseRepo
):
...
...
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