From 8f0e5c45fa0b37c3253db0cebb0ad0d07967af5e Mon Sep 17 00:00:00 2001
From: Stefano Alberto Russo <stefano.russo@gmail.com>
Date: Wed, 24 Nov 2021 02:17:19 +0100
Subject: [PATCH] Bugfix in getting the default container runtme and in case of
 unsupported container runtimes.

---
 services/webapp/code/rosetta/core_app/computing_managers.py | 4 ++--
 services/webapp/code/rosetta/core_app/models.py             | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/services/webapp/code/rosetta/core_app/computing_managers.py b/services/webapp/code/rosetta/core_app/computing_managers.py
index e130bb8..1e4dfa5 100644
--- a/services/webapp/code/rosetta/core_app/computing_managers.py
+++ b/services/webapp/code/rosetta/core_app/computing_managers.py
@@ -242,7 +242,7 @@ class SSHSingleNodeComputingManager(SingleNodeComputingManager, SSHComputingMana
             
 
         else:
-            raise NotImplementedError('Container {} not supported'.format(task.container.type))
+            raise NotImplementedError('Container runtime {} not supported'.format(self.computing.default_container_runtime))
 
         out = os_shell(run_command, capture=True)
         if out.exit_code != 0:
@@ -380,7 +380,7 @@ class SlurmSSHClusterComputingManager(ClusterComputingManager, SSHComputingManag
             run_command+='docker://{}/{}:{} &> \$HOME/{}.log\\" > \$HOME/{}.sh && sbatch {} \$HOME/{}.sh"\''.format(task.container.registry, task.container.image_name, task.container.image_tag, task.uuid, task.uuid, sbatch_args, task.uuid)
 
         else:
-            raise NotImplementedError('Default container runtime "{}" not supported'.format(task.computing.default_container_runtime))
+            raise NotImplementedError('Container runtime {} not supported'.format(task.computing.default_container_runtime))
 
         out = os_shell(run_command, capture=True)
         if out.exit_code != 0:
diff --git a/services/webapp/code/rosetta/core_app/models.py b/services/webapp/code/rosetta/core_app/models.py
index e772eea..968a303 100644
--- a/services/webapp/code/rosetta/core_app/models.py
+++ b/services/webapp/code/rosetta/core_app/models.py
@@ -228,7 +228,7 @@ class Computing(models.Model):
 
     @property
     def default_container_runtime(self):
-        return str(self.container_runtimes).split(',')[0]
+        return self.container_runtimes[0]
     
 
     #=======================
-- 
GitLab