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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ExaCT
Rosetta
Commits
afcf2f9c
Commit
afcf2f9c
authored
3 years ago
by
Stefano Alberto Russo
Browse files
Options
Downloads
Patches
Plain Diff
Moved to hashmap for selecting computing managers and renamed SingleNode in Standalone.
parent
aab0d1dd
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
services/webapp/code/rosetta/core_app/computing_managers.py
+13
-7
13 additions, 7 deletions
services/webapp/code/rosetta/core_app/computing_managers.py
services/webapp/code/rosetta/core_app/models.py
+9
-9
9 additions, 9 deletions
services/webapp/code/rosetta/core_app/models.py
with
22 additions
and
16 deletions
services/webapp/code/rosetta/core_app/computing_managers.py
+
13
−
7
View file @
afcf2f9c
...
...
@@ -73,7 +73,7 @@ class ComputingManager(object):
return
self
.
_get_task_log
(
task
,
**
kwargs
)
class
S
ingleNod
eComputingManager
(
ComputingManager
):
class
S
tandalon
eComputingManager
(
ComputingManager
):
pass
...
...
@@ -87,7 +87,7 @@ class SSHComputingManager(ComputingManager):
class
InternalS
ingleNod
eComputingManager
(
S
ingleNod
eComputingManager
):
class
InternalS
tandalon
eComputingManager
(
S
tandalon
eComputingManager
):
def
_start_task
(
self
,
task
):
...
...
@@ -176,7 +176,7 @@ class InternalSingleNodeComputingManager(SingleNodeComputingManager):
class
SSHS
ingleNod
eComputingManager
(
S
ingleNod
eComputingManager
,
SSHComputingManager
):
class
SSHS
tandalon
eComputingManager
(
S
tandalon
eComputingManager
,
SSHComputingManager
):
def
_start_task
(
self
,
task
,
**
kwargs
):
logger
.
debug
(
'
Starting a remote task
"
{}
"'
.
format
(
self
.
computing
))
...
...
@@ -188,8 +188,11 @@ class SSHSingleNodeComputingManager(SingleNodeComputingManager, SSHComputingMana
from
.
utils
import
get_webapp_conn_string
webapp_conn_string
=
get_webapp_conn_string
()
# Handle container runtime
if
self
.
computing
.
default_container_runtime
==
'
singularity
'
:
# Handle container runtime
container_runtime
=
task
.
computing_options
.
get
(
'
container_runtime
'
,
task
.
computing
.
default_container_runtime
)
# Runtime-specific part
if
container_runtime
==
'
singularity
'
:
#if not task.container.supports_custom_interface_port:
# raise Exception('This task does not support dynamic port allocation and is therefore not supported using singularity on Slurm')
...
...
@@ -327,8 +330,11 @@ class SlurmSSHClusterComputingManager(ClusterComputingManager, SSHComputingManag
# Set output and error files
sbatch_args
+=
'
--output=\$HOME/{}.log --error=\$HOME/{}.log
'
.
format
(
task
.
uuid
,
task
.
uuid
)
# Submit the job
if
task
.
computing
.
default_container_runtime
==
'
singularity
'
:
# Handle container runtime
container_runtime
=
task
.
computing_options
.
get
(
'
container_runtime
'
,
task
.
computing
.
default_container_runtime
)
# Runtime-specific part
if
container_runtime
==
'
singularity
'
:
#if not task.container.supports_custom_interface_port:
# raise Exception('This task does not support dynamic port allocation and is therefore not supported using singularity on Slurm')
...
...
This diff is collapsed.
Click to expand it.
services/webapp/code/rosetta/core_app/models.py
+
9
−
9
View file @
afcf2f9c
...
...
@@ -239,19 +239,19 @@ class Computing(models.Model):
def
manager
(
self
):
from
.
import
computing_managers
# Instantiate the computing manager based on type (if not already done)
# Hash table mapping
managers_mapping
=
{}
managers_mapping
[
'
cluster
'
+
'
ssh+cli
'
+
'
user_keys
'
+
'
slurm
'
]
=
computing_managers
.
SlurmSSHClusterComputingManager
managers_mapping
[
'
standalone
'
+
'
ssh+cli
'
+
'
user_keys
'
+
'
None
'
]
=
computing_managers
.
SSHStandaloneComputingManager
managers_mapping
[
'
standalone
'
+
'
internal
'
+
'
internal
'
+
'
None
'
]
=
computing_managers
.
InternalStandaloneComputingManager
# Instantiate the computing manager and return (if not already done)
try
:
return
self
.
_manager
except
AttributeError
:
if
self
.
type
==
'
cluster
'
and
self
.
access_mode
==
'
ssh+cli
'
and
self
.
auth_mode
==
'
user_keys
'
and
self
.
wms
==
'
slurm
'
:
self
.
_manager
=
computing_managers
.
SlurmSSHClusterComputingManager
(
self
)
elif
self
.
type
==
'
standalone
'
and
self
.
access_mode
==
'
ssh+cli
'
and
self
.
auth_mode
==
'
user_keys
'
and
self
.
wms
is
None
:
self
.
_manager
=
computing_managers
.
SSHSingleNodeComputingManager
(
self
)
elif
self
.
type
==
'
standalone
'
and
self
.
access_mode
==
'
internal
'
and
self
.
auth_mode
==
'
internal
'
and
self
.
wms
is
None
:
self
.
_manager
=
computing_managers
.
InternalSingleNodeComputingManager
(
self
)
else
:
raise
ConsistencyException
(
'
Don
\'
t know how to instantiate a computing manager for computing resource of type
"
{}
"
, access mode
"
{}
"
and WMS
"
{}
"'
.
format
(
self
.
type
,
self
.
access_mode
,
self
.
wms
))
self
.
_manager
=
managers_mapping
[
self
.
type
+
self
.
access_mode
+
self
.
auth_mode
+
str
(
self
.
wms
)](
self
)
return
self
.
_manager
#=========================
...
...
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