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
141c7ca6
Commit
141c7ca6
authored
3 years ago
by
Stefano Alberto Russo
Browse files
Options
Downloads
Patches
Plain Diff
Added support for Podman
parent
e4100990
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
services/webapp/code/rosetta/core_app/computing_managers.py
+12
-9
12 additions, 9 deletions
services/webapp/code/rosetta/core_app/computing_managers.py
with
12 additions
and
9 deletions
services/webapp/code/rosetta/core_app/computing_managers.py
+
12
−
9
View file @
141c7ca6
...
@@ -248,7 +248,7 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana
...
@@ -248,7 +248,7 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana
run_command
+=
'
docker://{}/{}:{} &>> /tmp/{}_data/task.log & echo \$!
"
\'
'
.
format
(
task
.
container
.
registry
,
task
.
container
.
image_name
,
task
.
container
.
image_tag
,
task
.
uuid
)
run_command
+=
'
docker://{}/{}:{} &>> /tmp/{}_data/task.log & echo \$!
"
\'
'
.
format
(
task
.
container
.
registry
,
task
.
container
.
image_name
,
task
.
container
.
image_tag
,
task
.
uuid
)
elif
container_runtime
==
'
docker
'
:
elif
container_runtime
in
[
'
docker
'
,
'
podman
'
]
:
# Set pass if any
# Set pass if any
authstring
=
''
authstring
=
''
...
@@ -288,12 +288,15 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana
...
@@ -288,12 +288,15 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana
binds
+=
'
-v{}:{}
'
.
format
(
expanded_base_path
,
expanded_bind_path
)
binds
+=
'
-v{}:{}
'
.
format
(
expanded_base_path
,
expanded_bind_path
)
# TODO: remove this hardcoding
# TODO: remove this hardcoding
prefix
=
'
sudo
'
if
computing_host
==
'
slurmclusterworker
'
else
''
prefix
=
'
sudo
'
if
(
computing_host
==
'
slurmclusterworker
'
and
container_runtime
==
'
docker
'
)
else
''
run_command
=
'
ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{}
'
.
format
(
computing_keys
.
private_key_file
,
computing_user
,
computing_host
)
run_command
=
'
ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{}
'
.
format
(
computing_keys
.
private_key_file
,
computing_user
,
computing_host
)
run_command
+=
'
/bin/bash -c
\'
"
rm -rf /tmp/{}_data && mkdir /tmp/{}_data && chmod 700 /tmp/{}_data &&
'
.
format
(
task
.
uuid
,
task
.
uuid
,
task
.
uuid
)
run_command
+=
'
/bin/bash -c
\'
"
rm -rf /tmp/{}_data && mkdir /tmp/{}_data && chmod 700 /tmp/{}_data &&
'
.
format
(
task
.
uuid
,
task
.
uuid
,
task
.
uuid
)
run_command
+=
'
wget {}/api/v1/base/agent/?task_uuid={} -O /tmp/{}_data/agent.py &> /dev/null && export TASK_PORT=\$(python /tmp/{}_data/agent.py 2> /tmp/{}_data/task.log) &&
'
.
format
(
webapp_conn_string
,
task
.
uuid
,
task
.
uuid
,
task
.
uuid
,
task
.
uuid
)
run_command
+=
'
wget {}/api/v1/base/agent/?task_uuid={} -O /tmp/{}_data/agent.py &> /dev/null && export TASK_PORT=\$(python /tmp/{}_data/agent.py 2> /tmp/{}_data/task.log) &&
'
.
format
(
webapp_conn_string
,
task
.
uuid
,
task
.
uuid
,
task
.
uuid
,
task
.
uuid
)
run_command
+=
'
{} docker run -p \$TASK_PORT:{} {} {}
'
.
format
(
prefix
,
task
.
container
.
interface_port
,
authstring
,
binds
)
run_command
+=
'
{} {} run -p \$TASK_PORT:{} {} {}
'
.
format
(
prefix
,
container_runtime
,
task
.
container
.
interface_port
,
authstring
,
binds
)
if
container_runtime
==
'
podman
'
:
run_command
+=
'
--network=private --uts=private
'
#run_command += '-d -t {}/{}:{}'.format(task.container.registry, task.container.image_name, task.container.image_tag)
run_command
+=
'
-h task-{} -d -t {}/{}:{}
'
.
format
(
task
.
short_uuid
,
task
.
container
.
registry
,
task
.
container
.
image_name
,
task
.
container
.
image_tag
)
run_command
+=
'
-h task-{} -d -t {}/{}:{}
'
.
format
(
task
.
short_uuid
,
task
.
container
.
registry
,
task
.
container
.
image_name
,
task
.
container
.
image_tag
)
run_command
+=
'"
\'
'
run_command
+=
'"
\'
'
...
@@ -332,10 +335,10 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana
...
@@ -332,10 +335,10 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana
if
container_runtime
==
'
singularity
'
:
if
container_runtime
==
'
singularity
'
:
internal_stop_command
=
'
kill -9 {}
'
.
format
(
task
.
id
)
internal_stop_command
=
'
kill -9 {}
'
.
format
(
task
.
id
)
elif
container_runtime
==
'
docker
'
:
elif
container_runtime
in
[
'
docker
'
,
'
podman
'
]
:
# TODO: remove this hardcoding
# TODO: remove this hardcoding
prefix
=
'
sudo
'
if
computing_host
==
'
slurmclusterworker
'
else
''
prefix
=
'
sudo
'
if
(
computing_host
==
'
slurmclusterworker
'
and
container_runtime
==
'
docker
'
)
else
''
internal_stop_command
=
'
{}
docker
stop {} && {}
docker
rm {}
'
.
format
(
prefix
,
task
.
id
,
prefix
,
task
.
id
)
internal_stop_command
=
'
{}
{}
stop {} && {}
{}
rm {}
'
.
format
(
prefix
,
container_runtime
,
task
.
id
,
prefix
,
container_runtime
,
task
.
id
)
else
:
else
:
raise
NotImplementedError
(
'
Container runtime {} not supported
'
.
format
(
container_runtime
))
raise
NotImplementedError
(
'
Container runtime {} not supported
'
.
format
(
container_runtime
))
...
@@ -366,10 +369,10 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana
...
@@ -366,10 +369,10 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana
if
container_runtime
==
'
singularity
'
:
if
container_runtime
==
'
singularity
'
:
internal_view_log_command
=
'
cat /tmp/{}_data/task.log
'
.
format
(
task
.
uuid
)
internal_view_log_command
=
'
cat /tmp/{}_data/task.log
'
.
format
(
task
.
uuid
)
elif
container_runtime
==
'
docker
'
:
elif
container_runtime
in
[
'
docker
'
,
'
podman
'
]
:
# TODO: remove this hardcoding
# TODO: remove this hardcoding
prefix
=
'
sudo
'
if
computing_host
==
'
slurmclusterworker
'
else
''
prefix
=
'
sudo
'
if
(
computing_host
==
'
slurmclusterworker
'
and
container_runtime
==
'
docker
'
)
else
''
internal_view_log_command
=
'
{}
docker
logs {}
'
.
format
(
prefix
,
task
.
id
)
internal_view_log_command
=
'
{}
{}
logs {}
'
.
format
(
prefix
,
container_runtime
,
task
.
id
)
else
:
else
:
raise
NotImplementedError
(
'
Container runtime {} not supported
'
.
format
(
container_runtime
))
raise
NotImplementedError
(
'
Container runtime {} not supported
'
.
format
(
container_runtime
))
...
...
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