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
a4c29854
Commit
a4c29854
authored
11 months ago
by
r.jaepel
Browse files
Options
Downloads
Patches
Plain Diff
Ensure git-lfs is installed whenever repo is used.
parent
badd2bde
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cadetrdm/initialize_repo.py
+9
-6
9 additions, 6 deletions
cadetrdm/initialize_repo.py
cadetrdm/repositories.py
+7
-2
7 additions, 2 deletions
cadetrdm/repositories.py
with
16 additions
and
8 deletions
cadetrdm/initialize_repo.py
+
9
−
6
View file @
a4c29854
...
...
@@ -11,7 +11,6 @@ except ImportError:
import
cadetrdm
from
cadetrdm.repositories
import
ProjectRepo
,
OutputRepo
from
cadetrdm.web_utils
import
ssh_url_to_http_url
from
cadetrdm.io_utils
import
write_lines_to_file
,
is_tool
,
wait_for_user
,
init_lfs
...
...
@@ -33,11 +32,7 @@ def initialize_repo(path_to_repo: str | Path, output_folder_name: (str | bool) =
Include gitignore, gitattributes, and lfs_filetypes kwargs.
:return:
"""
if
not
is_tool
(
"
git-lfs
"
):
raise
RuntimeError
(
"
Git LFS is not installed. Please install it via e.g. apt-get install git-lfs or the
"
"
instructions found below
\n
"
"
https://docs.github.com/en/repositories/working-with-files
"
"
/managing-large-files/installing-git-large-file-storage
"
)
test_for_lfs
()
if
gitignore
is
None
:
gitignore
=
get_default_gitignore
()
+
[
"
*.ipynb
"
]
...
...
@@ -109,6 +104,14 @@ def initialize_repo(path_to_repo: str | Path, output_folder_name: (str | bool) =
os
.
chdir
(
starting_directory
)
def
test_for_lfs
():
if
not
is_tool
(
"
git-lfs
"
):
raise
RuntimeError
(
"
Git LFS is not installed. Please install it via e.g. apt-get install git-lfs or the
"
"
instructions found below
\n
"
"
https://docs.github.com/en/repositories/working-with-files
"
"
/managing-large-files/installing-git-large-file-storage
"
)
def
initialize_git
(
folder
=
"
.
"
):
starting_directory
=
os
.
getcwd
()
if
folder
!=
"
:
"
:
...
...
This diff is collapsed.
Click to expand it.
cadetrdm/repositories.py
+
7
−
2
View file @
a4c29854
...
...
@@ -5,12 +5,14 @@ import os
import
shutil
import
sys
import
traceback
import
warnings
from
datetime
import
datetime
from
pathlib
import
Path
from
stat
import
S_IREAD
,
S_IWRITE
from
urllib.request
import
urlretrieve
import
cadetrdm
from
cadetrdm.initialize_repo
import
test_for_lfs
from
cadetrdm.io_utils
import
delete_path
from
cadetrdm.io_utils
import
recursive_chmod
,
write_lines_to_file
,
wait_for_user
,
init_lfs
from
cadetrdm.jupyter_functionality
import
Notebook
...
...
@@ -627,6 +629,8 @@ class ProjectRepo(BaseRepo):
"""
super
().
__init__
(
repository_path
,
search_parent_directories
=
search_parent_directories
,
*
args
,
**
kwargs
)
test_for_lfs
()
if
output_folder
is
not
None
:
print
(
"
Deprecation Warning. Setting the outputfolder manually during repo instantiation is deprecated
"
"
and will be removed in a future update.
"
)
...
...
@@ -635,7 +639,8 @@ class ProjectRepo(BaseRepo):
raise
RuntimeError
(
f
"
Folder
{
self
.
path
}
does not appear to be a CADET-RDM repository.
"
)
metadata
=
self
.
load_metadata
()
self
.
_project_uuid
=
metadata
[
"
project_uuid
"
]
self
.
_output_uuid
=
metadata
[
"
output_uuid
"
]
self
.
_output_folder
=
metadata
[
"
output_remotes
"
][
"
output_folder_name
"
]
if
not
(
self
.
path
/
self
.
_output_folder
).
exists
():
print
(
"
Output repository was missing, cloning now.
"
)
...
...
@@ -698,7 +703,7 @@ class ProjectRepo(BaseRepo):
ssh_remotes
=
list
(
output_remotes
[
"
output_remotes
"
].
values
())
http_remotes
=
[
ssh_url_to_http_url
(
url
)
for
url
in
ssh_remotes
]
if
len
(
ssh_remotes
+
http_remotes
)
==
0
:
raise
RuntimeError
(
"
No output remotes configured in .cadet-rdm-data.json
"
)
warnings
.
warn
(
"
No output remotes configured in .cadet-rdm-data.json
"
)
for
output_remote
in
ssh_remotes
+
http_remotes
:
try
:
print
(
f
"
Attempting to clone
{
output_remote
}
into
{
output_path
}
"
)
...
...
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