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
cec548aa
Commit
cec548aa
authored
1 year ago
by
Ronald Jäpel
Browse files
Options
Downloads
Patches
Plain Diff
temp jupyter enter context fix
parent
06f4de6f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cadetrdm/repositories.py
+15
-7
15 additions, 7 deletions
cadetrdm/repositories.py
with
15 additions
and
7 deletions
cadetrdm/repositories.py
+
15
−
7
View file @
cec548aa
...
@@ -371,11 +371,14 @@ class BaseRepo:
...
@@ -371,11 +371,14 @@ class BaseRepo:
"""
"""
self
.
add
(
"
.
"
)
self
.
add
(
"
.
"
)
def
reset_hard_to_head
(
self
):
def
reset_hard_to_head
(
self
,
force_entry
=
False
):
proceed
=
wait_for_user
(
f
'
The output directory contains the following uncommitted changes:
\n
'
if
not
force_entry
:
proceed
=
wait_for_user
(
f
'
The output directory contains the following uncommitted changes:
\n
'
f
'
{
self
.
untracked_files
+
self
.
changed_files
}
\n
'
f
'
{
self
.
untracked_files
+
self
.
changed_files
}
\n
'
f
'
These will be lost if you continue
\n
'
f
'
These will be lost if you continue
\n
'
f
'
Proceed?
'
)
f
'
Proceed?
'
)
else
:
proceed
=
True
if
not
proceed
:
if
not
proceed
:
raise
KeyboardInterrupt
raise
KeyboardInterrupt
# reset all tracked files to previous commit, -q silences output
# reset all tracked files to previous commit, -q silences output
...
@@ -611,6 +614,7 @@ class ProjectRepo(BaseRepo):
...
@@ -611,6 +614,7 @@ class ProjectRepo(BaseRepo):
if
current_version
<
9
:
if
current_version
<
9
:
self
.
convert_csv_to_tsv_if_necessary
()
self
.
convert_csv_to_tsv_if_necessary
()
self
.
add_jupytext_file
(
self
.
working_dir
)
self
.
add_jupytext_file
(
self
.
working_dir
)
# ToDo: actually update version
@staticmethod
@staticmethod
def
add_jupytext_file
(
path_root
:
str
|
Path
=
"
.
"
):
def
add_jupytext_file
(
path_root
:
str
|
Path
=
"
.
"
):
...
@@ -896,7 +900,7 @@ class ProjectRepo(BaseRepo):
...
@@ -896,7 +900,7 @@ class ProjectRepo(BaseRepo):
:return:
:return:
"""
"""
def
enter_context
(
self
,
):
def
enter_context
(
self
,
force
=
False
):
"""
"""
Enter the tracking context. This includes:
Enter the tracking context. This includes:
- Ensure no uncommitted changes in the project repository
- Ensure no uncommitted changes in the project repository
...
@@ -914,7 +918,7 @@ class ProjectRepo(BaseRepo):
...
@@ -914,7 +918,7 @@ class ProjectRepo(BaseRepo):
output_repo
=
self
.
output_repo
output_repo
=
self
.
output_repo
if
output_repo
.
exist_uncomitted_changes
:
if
output_repo
.
exist_uncomitted_changes
:
output_repo
.
reset_hard_to_head
()
output_repo
.
reset_hard_to_head
(
force_entry
=
force
)
output_repo
.
delete_active_branch_if_branch_is_empty
()
output_repo
.
delete_active_branch_if_branch_is_empty
()
...
@@ -1015,12 +1019,16 @@ class ProjectRepo(BaseRepo):
...
@@ -1015,12 +1019,16 @@ class ProjectRepo(BaseRepo):
else
:
else
:
self
.
exit_context
(
message
=
results_commit_message
)
self
.
exit_context
(
message
=
results_commit_message
)
def
commit_n
otebook
(
self
,
notebook_path
:
str
,
results_commit_message
:
str
,
def
commit_n
b_output
(
self
,
notebook_path
:
str
,
results_commit_message
:
str
,
force_rerun
=
False
,
timeout
=
600
,
conversion_formats
:
list
=
None
):
force_rerun
=
False
,
timeout
=
600
,
conversion_formats
:
list
=
None
):
if
not
Path
(
notebook_path
).
is_absolute
():
if
not
Path
(
notebook_path
).
is_absolute
():
notebook_path
=
self
.
working_dir
/
notebook_path
notebook_path
=
self
.
working_dir
/
notebook_path
self
.
enter_context
()
# if "nbconvert_call" in sys.argv:
# # This won't work as intended.
# self.enter_context(force=True)
# else:
# self.enter_context(force=False)
notebook
=
Notebook
(
notebook_path
)
notebook
=
Notebook
(
notebook_path
)
notebook
.
check_and_rerun_notebook
(
force_rerun
=
force_rerun
,
notebook
.
check_and_rerun_notebook
(
force_rerun
=
force_rerun
,
...
...
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