Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rosetta
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
Container 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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ExaCT
Rosetta
Commits
53ae2ea4
Commit
53ae2ea4
authored
Apr 10, 2024
by
Stefano Alberto Russo
Browse files
Options
Downloads
Patches
Plain Diff
Added support for the internal storage in the internal computing resource. Minor fixes.
parent
c23d27e7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
services/webapp/code/rosetta/core_app/computing_managers.py
+27
-1
27 additions, 1 deletion
services/webapp/code/rosetta/core_app/computing_managers.py
services/webapp/code/rosetta/core_app/models.py
+5
-1
5 additions, 1 deletion
services/webapp/code/rosetta/core_app/models.py
with
32 additions
and
2 deletions
services/webapp/code/rosetta/core_app/computing_managers.py
+
27
−
1
View file @
53ae2ea4
...
...
@@ -131,8 +131,30 @@ class InternalStandaloneComputingManager(StandaloneComputingManager):
# User data volume
#run_command += ' -v {}/user-{}:/data'.format(settings.LOCAL_USER_DATA_DIR, task.user.id)
# Handle storages (binds)
binds
=
''
storages
=
Storage
.
objects
.
filter
(
computing
=
self
.
computing
)
for
storage
in
storages
:
if
storage
.
type
==
'
generic_posix
'
and
storage
.
bind_path
:
# Expand the base path
expanded_base_path
=
storage
.
base_path
if
'
$USER
'
in
expanded_base_path
:
expanded_base_path
=
expanded_base_path
.
replace
(
'
$USER
'
,
task
.
user
.
username
)
# Expand the bind_path
expanded_bind_path
=
storage
.
bind_path
if
'
$USER
'
in
expanded_bind_path
:
expanded_bind_path
=
expanded_bind_path
.
replace
(
'
$USER
'
,
task
.
user
.
username
)
# Add the bind
if
not
binds
:
binds
=
'
-v{}:{}
'
.
format
(
expanded_base_path
,
expanded_bind_path
)
else
:
binds
+=
'
-v{}:{}
'
.
format
(
expanded_base_path
,
expanded_bind_path
)
# Host name, image entry command
run_command
+=
'
-h task-{} --name task-{} -d -t {}/{}:{}
'
.
format
(
task
.
short_uuid
,
task
.
short_uuid
,
task
.
container
.
registry
,
task
.
container
.
image_name
,
task
.
container
.
image_tag
)
run_command
+=
'
{}
-h task-{} --name task-{} -d -t {}/{}:{}
'
.
format
(
binds
,
task
.
short_uuid
,
task
.
short_uuid
,
task
.
container
.
registry
,
task
.
container
.
image_name
,
task
.
container
.
image_tag
)
# Debug
logger
.
debug
(
'
Running new task with command=
"
{}
"'
.
format
(
run_command
))
...
...
@@ -166,6 +188,10 @@ class InternalStandaloneComputingManager(StandaloneComputingManager):
out
=
os_shell
(
stop_command
,
capture
=
True
)
if
out
.
exit_code
!=
0
:
if
'
No such container
'
in
out
.
stderr
:
# No container was found
pass
elif
'
requires at least 1 argument
'
in
out
.
stderr
:
# No container was found
pass
else
:
raise
Exception
(
out
.
stderr
)
...
...
This diff is collapsed.
Click to expand it.
services/webapp/code/rosetta/core_app/models.py
+
5
−
1
View file @
53ae2ea4
...
...
@@ -398,6 +398,10 @@ class Storage(models.Model):
# Include as browsable in the file manager?
browsable
=
models
.
BooleanField
(
'
Browsable in the file manager?
'
,
default
=
True
)
def
save
(
self
,
*
args
,
**
kwargs
):
if
self
.
access_mode
==
'
internal
'
and
self
.
browsable
:
raise
ValueError
(
'
A storage with
"
internal
"
access mode cannot be marked as browsable since it is not yet supported by the file manager
'
)
super
(
Storage
,
self
).
save
(
*
args
,
**
kwargs
)
class
Meta
:
ordering
=
[
'
name
'
]
...
...
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