From ad8f784f830e61fd954436620f8905cea929e35b Mon Sep 17 00:00:00 2001
From: Johannes Hjorth <hjorth@kth.se>
Date: Mon, 17 Mar 2025 17:45:24 +0100
Subject: [PATCH 01/13] feat(py-snudda): add version 2.1.10

---
 packages/py-snudda/package.py | 33 ++++++++++++++++-----------------
 spack.yaml                    |  2 +-
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/packages/py-snudda/package.py b/packages/py-snudda/package.py
index f8458a3f..97b72292 100644
--- a/packages/py-snudda/package.py
+++ b/packages/py-snudda/package.py
@@ -10,10 +10,12 @@ class PySnudda(PythonPackage):
     """Snudda creates the connectivity for realistic networks of simulated neurons in silico in a bottom up fashion that can then be simulated using the NEURON software."""
 
     homepage = "https://pypi.org/project/snudda/"
-    pypi     = "snudda/snudda-2.0.1.tar.gz"
+    pypi     = "snudda/snudda-2.1.2.tar.gz"
 
     maintainers = ["hjorth"]
-    
+
+    version("2.1.10", "a1f5bf39ee0418e7ce8a0783042c59c8")
+    version("2.1.2", "5d61a548995f88f95f680bf124534287")
     version("2.0.1", "0d78f5ca2cfe728b216f980078d8558a")
     version("1.4.71", "5871e4af5e1a011d26a22d7dc384638a")
     version("1.4.0", "55f9b398b01b34bf3cec28c8a3aebc78")
@@ -22,23 +24,20 @@ class PySnudda(PythonPackage):
     depends_on("unzip",                 type=("build"))
     depends_on("py-setuptools",         type=("build"))
     depends_on("py-importlib-metadata", type=("build","run"))
-    depends_on("py-bluepyopt@1.11.7:",  type=("build","run"))
-    depends_on("py-h5py@3.2.1:",        type=("build","run"))
-    depends_on("py-ipyparallel@6.3.0:", type=("build","run"))
-    depends_on("py-matplotlib@3.3.4:",  type=("build","run"))
-    depends_on("py-mpi4py@3.0.3:",      type=("build","run"))
-    depends_on("py-numpy@1.20.2:",      type=("build","run"))
-    depends_on("py-scipy@1.6.3:",       type=("build","run"))
-    depends_on("py-libsonata@0.0.2:",   type=("build","run"))
-    depends_on("py-pyzmq@22.0.3:",      type=("build","run"))
-    depends_on("py-numexpr@2.7.3:",     type=("build","run"))
-    depends_on("neuron@7.8.2:",         type=("build","run"))
+    depends_on("py-bluepyopt@1.14.11:", type=("build","run"))
+    depends_on("py-h5py@3.12.1:",       type=("build","run"))
+    depends_on("py-ipyparallel@8.4.1:", type=("build","run"))
+    depends_on("py-matplotlib@3.8:",    type=("build","run"))
+    depends_on("py-mpi4py@4.0.1:",      type=("build","run"))
+    depends_on("py-numpy@1.25.2:1",     type=("build","run"))
+    depends_on("py-scipy@1.13.1:",      type=("build","run"))
+    depends_on("py-numexpr@2.9.0:",    type=("build","run"))
+    depends_on("neuron@8.2.3:",         type=("build","run"))
     depends_on("py-pyswarms@1.3.0:",    type=("build","run"))
-    depends_on("py-psutil",             type=("build","run"))
+    depends_on("py-psutil@5.9.5:",      type=("build","run"))
     depends_on("py-cython",             type=("build","run"))
-    depends_on("py-numba@0.53.1:",      type=("build","run"))
-    depends_on("open3d+python",         type=("build","run"), when="@2:")
-
+    depends_on("py-numba@0.60.0:",      type=("build","run"))
+    depends_on("open3d+python@0.18:",   type=("build","run"), when="@2:")
 
     # snudda tarballs in pypi do not include the tests/ dir: just use default spack tests for now
     # @run_after('install')
diff --git a/spack.yaml b/spack.yaml
index 9c100dda..e83194e0 100644
--- a/spack.yaml
+++ b/spack.yaml
@@ -51,7 +51,7 @@ spack:
     - py-quantities-scidash@0.12.4.3
     - py-quantities@0.16.0
     - py-siibra@1.0a9
-    - py-snudda@2.0.1
+    - py-snudda@2.1.10
     - py-spynnaker@7.3.0
     - py-tvb-framework@2.9
     - py-tvb-contrib@2.9.1
-- 
GitLab


From 5abe11f832e2fc9202776ac0805ca2402e3ed3ca Mon Sep 17 00:00:00 2001
From: Abolfazl  Ziaeemehr <a.ziaeemehr@gmail.com>
Date: Tue, 18 Mar 2025 10:38:22 +0100
Subject: [PATCH 02/13] feat(py-vbi): add version 0.1.3.2 and update dependency
 in spack.yaml

---
 packages/py-vbi/package.py | 1 +
 spack.yaml                 | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/packages/py-vbi/package.py b/packages/py-vbi/package.py
index 2fee3590..64d82123 100644
--- a/packages/py-vbi/package.py
+++ b/packages/py-vbi/package.py
@@ -12,6 +12,7 @@ class PyVbi(PythonPackage, CudaPackage):
     git = "https://github.com/ins-amu/vbi"
     url = "https://github.com/ins-amu/vbi/archive/refs/tags/v0.1.3.tar.gz"
 
+    version("0.1.3.2", "6de0367b15834195ad1c14c61e4286875b5fe32d86975185977065765564576d")
     version("0.1.3.1", "53f085aba83129d01a8ad6d3deadc768db38b7a8545bcbc4427e70db2b6e66c0")
     version("0.1.3", "8ccccf2bf0def2bf97f4706b8597c4cb3ac5f0cf2ac5f08566e22cd6273c1163")
     version("0.1.2", "6ccfeeec718be62a480002a8370130a3e3344955186f99ecbb15b646b68210d6")
diff --git a/spack.yaml b/spack.yaml
index e83194e0..b99a8270 100644
--- a/spack.yaml
+++ b/spack.yaml
@@ -62,7 +62,7 @@ spack:
     - py-tvb-ext-unicore
     - py-tvb-ext-xircuits@1.1.0
     - py-viziphant@0.4.0
-    - py-vbi@0.1.3.1
+    - py-vbi@0.1.3.2
     - pynn-brainscales@10.0-a1
     - r-rgsl@0.1.1
     - r-sbtabvfgen@0.1
-- 
GitLab


From a8d082597eb1ea641743272a65983f0999ee538b Mon Sep 17 00:00:00 2001
From: Johannes Hjorth <hjorth@kth.se>
Date: Tue, 18 Mar 2025 11:22:53 +0100
Subject: [PATCH 03/13] feat(py-snudda): update dependency on BluePyOpt 1.14.18

---
 packages/py-snudda/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/py-snudda/package.py b/packages/py-snudda/package.py
index 97b72292..8d0ca3d8 100644
--- a/packages/py-snudda/package.py
+++ b/packages/py-snudda/package.py
@@ -24,7 +24,7 @@ class PySnudda(PythonPackage):
     depends_on("unzip",                 type=("build"))
     depends_on("py-setuptools",         type=("build"))
     depends_on("py-importlib-metadata", type=("build","run"))
-    depends_on("py-bluepyopt@1.14.11:", type=("build","run"))
+    depends_on("py-bluepyopt@1.14.18:", type=("build","run"))
     depends_on("py-h5py@3.12.1:",       type=("build","run"))
     depends_on("py-ipyparallel@8.4.1:", type=("build","run"))
     depends_on("py-matplotlib@3.8:",    type=("build","run"))
-- 
GitLab


From b3e0efa7efee5e273047bf5a7016abad2a314a1f Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Tue, 18 Mar 2025 11:41:29 +0000
Subject: [PATCH 04/13] feat(py-bluepyopt): copy package from upstream

---
 packages/py-bluepyopt/package.py     | 41 ++++++++++++++++++++++++++++
 packages/py-bluepyopt/pmi_rank.patch | 17 ++++++++++++
 2 files changed, 58 insertions(+)
 create mode 100644 packages/py-bluepyopt/package.py
 create mode 100644 packages/py-bluepyopt/pmi_rank.patch

diff --git a/packages/py-bluepyopt/package.py b/packages/py-bluepyopt/package.py
new file mode 100644
index 00000000..67cfa6b6
--- /dev/null
+++ b/packages/py-bluepyopt/package.py
@@ -0,0 +1,41 @@
+# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+from spack.package import *
+
+
+class PyBluepyopt(PythonPackage):
+    """Bluebrain Python Optimisation Library"""
+
+    homepage = "https://github.com/BlueBrain/BluePyOpt"
+    pypi = "bluepyopt/bluepyopt-1.9.27.tar.gz"
+
+    license("LGPL-3.0-only")
+
+    # NOTE : while adding new release check pmi_rank.patch compatibility
+    version("1.14.11", sha256="fe2830c36699a93d2ef9ddef316da42f9c57ca6654c92356eab973ee2298ebf7")
+    version("1.14.4", sha256="7567fd736053250ca06030f67ad93c607b100c2b98df8dc588c26b64cb3e171c")
+
+    # patch required to avoid hpe-mpi linked mechanism library
+    patch("pmi_rank.patch")
+
+    variant("scoop", default=False, description="Use BluePyOpt together with py-scoop")
+
+    depends_on("py-setuptools", type="build")
+    depends_on("py-numpy@1.6:", type=("build", "run"))
+    depends_on("py-pandas@0.18:", type=("build", "run"))
+    depends_on("py-deap@1.3.3:", type=("build", "run"))
+    depends_on("py-efel@2.13:", type=("build", "run"))
+    depends_on("py-ipyparallel", type=("build", "run"))
+    depends_on("py-pickleshare@0.7.3:", type=("build", "run"))
+    depends_on("py-jinja2@2.8:", type=("build", "run"))
+    depends_on("py-future", type=("build", "run"))
+    depends_on("py-pebble@4.6:", type=("build", "run"))
+    depends_on("py-scoop@0.7:", type=("build", "run"), when="+scoop")
+    depends_on("neuron@7.4:", type=("build", "run"), when="@:1.14.4")
+    depends_on("neuron@7.8:", type=("build", "run"), when="@1.14.11:")
+
+    def setup_run_environment(self, env):
+        env.unset("PMI_RANK")
+        env.set("NEURON_INIT_MPI", "0")
diff --git a/packages/py-bluepyopt/pmi_rank.patch b/packages/py-bluepyopt/pmi_rank.patch
new file mode 100644
index 00000000..21a73849
--- /dev/null
+++ b/packages/py-bluepyopt/pmi_rank.patch
@@ -0,0 +1,17 @@
+diff --git a/bluepyopt/ephys/simulators.py b/bluepyopt/ephys/simulators.py
+index e71ad8b..3c93237 100644
+--- a/bluepyopt/ephys/simulators.py
++++ b/bluepyopt/ephys/simulators.py
+@@ -89,6 +89,12 @@ class NrnSimulator(object):
+             NrnSimulator._nrn_disable_banner()
+             self.banner_disabled = True
+ 
++        # certain mpi libraries (hpe-mpt) use PMI_RANK env variable to initialize
++        # MPI before calling MPI_Init (which is undesirable). Unset this variable
++        # if exist to avoid issue with loading neuron and mechanism library.
++        if 'PMI_RANK' in os.environ:
++            os.environ.pop("PMI_RANK")
++
+         import neuron  # NOQA
+ 
+         return neuron
-- 
GitLab


From 3a218965d70438e710232b3bf25f8c737fbc3ea0 Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Tue, 18 Mar 2025 11:42:42 +0000
Subject: [PATCH 05/13] feat(py-bluepyopt): add version 1.14.18

---
 packages/py-bluepyopt/package.py | 1 +
 spack.yaml                       | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/packages/py-bluepyopt/package.py b/packages/py-bluepyopt/package.py
index 67cfa6b6..aa4e5254 100644
--- a/packages/py-bluepyopt/package.py
+++ b/packages/py-bluepyopt/package.py
@@ -14,6 +14,7 @@ class PyBluepyopt(PythonPackage):
     license("LGPL-3.0-only")
 
     # NOTE : while adding new release check pmi_rank.patch compatibility
+    version("1.14.18", sha256="23d6239294d944c8f9d4ea298091bcf243d236735844e1bcba60535a0f520ca8")
     version("1.14.11", sha256="fe2830c36699a93d2ef9ddef316da42f9c57ca6654c92356eab973ee2298ebf7")
     version("1.14.4", sha256="7567fd736053250ca06030f67ad93c607b100c2b98df8dc588c26b64cb3e171c")
 
diff --git a/spack.yaml b/spack.yaml
index b99a8270..809334f9 100644
--- a/spack.yaml
+++ b/spack.yaml
@@ -18,7 +18,7 @@ spack:
     - jaxsnn@10.0-a1
     - py-bluepyefe@2.3.6
     - py-bluepymm@0.8.7
-    - py-bluepyopt@1.14.11
+    - py-bluepyopt@1.14.18
     - py-bsb-core@5.0.2
     - py-bsb-hdf5@5.0.2
     - py-bsb-yaml@4.2.2
-- 
GitLab


From d35d416ce4c0a38197693a051111a1a277f1985d Mon Sep 17 00:00:00 2001
From: Abolfazl  Ziaeemehr <a.ziaeemehr@gmail.com>
Date: Thu, 20 Mar 2025 14:26:01 +0100
Subject: [PATCH 06/13] feat(py-vbi): update py-vbi to version 0.1.3.3

---
 packages/py-vbi/package.py | 1 +
 spack.yaml                 | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/packages/py-vbi/package.py b/packages/py-vbi/package.py
index 64d82123..238ccf0f 100644
--- a/packages/py-vbi/package.py
+++ b/packages/py-vbi/package.py
@@ -12,6 +12,7 @@ class PyVbi(PythonPackage, CudaPackage):
     git = "https://github.com/ins-amu/vbi"
     url = "https://github.com/ins-amu/vbi/archive/refs/tags/v0.1.3.tar.gz"
 
+    version("0.1.3.3", "a75041af2bd5dbf6e11970a82620f820c74cb124000403f711d657f347f18a88")
     version("0.1.3.2", "6de0367b15834195ad1c14c61e4286875b5fe32d86975185977065765564576d")
     version("0.1.3.1", "53f085aba83129d01a8ad6d3deadc768db38b7a8545bcbc4427e70db2b6e66c0")
     version("0.1.3", "8ccccf2bf0def2bf97f4706b8597c4cb3ac5f0cf2ac5f08566e22cd6273c1163")
diff --git a/spack.yaml b/spack.yaml
index 809334f9..da2a6fb2 100644
--- a/spack.yaml
+++ b/spack.yaml
@@ -62,7 +62,7 @@ spack:
     - py-tvb-ext-unicore
     - py-tvb-ext-xircuits@1.1.0
     - py-viziphant@0.4.0
-    - py-vbi@0.1.3.2
+    - py-vbi@0.1.3.3
     - pynn-brainscales@10.0-a1
     - r-rgsl@0.1.1
     - r-sbtabvfgen@0.1
-- 
GitLab


From 297590ab3414e50f4057bfcf29370848e124bb74 Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Thu, 20 Mar 2025 18:32:59 +0100
Subject: [PATCH 07/13] fix(ebrainslab): pin version of py-ipywidgets and
 py-jupyterlab-widgets

to be compatible with the Lab's base image
---
 site-config/ebrainslab/spack.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/site-config/ebrainslab/spack.yaml b/site-config/ebrainslab/spack.yaml
index 5e2f9363..25336210 100644
--- a/site-config/ebrainslab/spack.yaml
+++ b/site-config/ebrainslab/spack.yaml
@@ -7,7 +7,7 @@ spack:
     - py-notebook
     - r-irkernel
     # "collab"-specific constraint to match ("jupyterlab_widgets") in the base image
-    - py-ipywidgets
+    - py-ipywidgets@7.7.0
+    - py-jupyterlab-widgets@1.1.0
     # Collab utils
     - clb-nb-utils@0.1.0
-
-- 
GitLab


From 15f1048c1472abe6884724fbd4e785adb0ac3269 Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Thu, 20 Mar 2025 19:56:32 +0100
Subject: [PATCH 08/13] fix: add missing py-jupyter-core dependency to Jupyter
 Extension packages

to correctly set jupyter extension env vars
---
 packages/py-ipycanvas/package.py       | 1 +
 packages/py-tvb-ext-bucket/package.py  | 1 +
 packages/py-tvb-ext-unicore/package.py | 1 +
 3 files changed, 3 insertions(+)

diff --git a/packages/py-ipycanvas/package.py b/packages/py-ipycanvas/package.py
index 0883611f..a37909bf 100644
--- a/packages/py-ipycanvas/package.py
+++ b/packages/py-ipycanvas/package.py
@@ -24,6 +24,7 @@ class PyIpycanvas(PythonPackage):
     # begin EBRAINS (added)
     depends_on("python@3.6:", when="@0.10:", type=("build", "run"))
     depends_on("python@3.7:", when="@0.11:", type=("build", "run"))
+    depends_on('py-jupyter-core', type=("build", "run"))
     # end EBRAINS
     depends_on("py-setuptools@40.8:", type="build")
     depends_on("py-jupyter-packaging@0.7", type="build")
diff --git a/packages/py-tvb-ext-bucket/package.py b/packages/py-tvb-ext-bucket/package.py
index 29fdae03..ffb6558e 100644
--- a/packages/py-tvb-ext-bucket/package.py
+++ b/packages/py-tvb-ext-bucket/package.py
@@ -15,6 +15,7 @@ class PyTvbExtBucket(PythonPackage):
     depends_on('py-setuptools', type='build')
     depends_on('python@3.8:', type=('build', 'run'))
     depends_on('py-jupyter-server', type=('build', 'run'))
+    depends_on('py-jupyter-core', type=("build", "run"))
     depends_on('py-ebrains-drive@0.5.0:', type=('build', 'run'))
     depends_on('py-hatchling@1.5.0:', type='build')
     depends_on('py-jupyterlab@3.4.7:3', type=('build', 'run'))
diff --git a/packages/py-tvb-ext-unicore/package.py b/packages/py-tvb-ext-unicore/package.py
index 786e2f6e..f55bf951 100644
--- a/packages/py-tvb-ext-unicore/package.py
+++ b/packages/py-tvb-ext-unicore/package.py
@@ -21,6 +21,7 @@ class PyTvbExtUnicore(PythonPackage):
     depends_on('py-hatch-jupyter-builder@0.5:', type='build')
     depends_on('py-jupyterlab@3.4.7:3', type=('build', 'run'))
     depends_on('py-jupyter-server', type=('build', 'run'))
+    depends_on('py-jupyter-core', type=("build", "run"))
     depends_on('py-pyunicore@1.0:', type=('build', 'run'))
     depends_on('py-jupyter-packaging@0.10:', type='build')
     depends_on('npm', type='build')
-- 
GitLab


From 908d35854634513df9efe1080b92ac44be6a1f69 Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Thu, 20 Mar 2025 23:19:42 +0100
Subject: [PATCH 09/13] fix(CI): switch back to using local node's disk for
 /tmp

to avoid fs errors
---
 create_job.sh | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/create_job.sh b/create_job.sh
index f7b5d089..56d80c8f 100644
--- a/create_job.sh
+++ b/create_job.sh
@@ -105,13 +105,6 @@ spec:
           persistentVolumeClaim:
             claimName: shared-binaries
         - name: tmp
-          ephemeral:
-            volumeClaimTemplate:
-              spec:
-                accessModes: [ "ReadWriteMany" ]
-                storageClassName: "longhorn-0"
-                resources:
-                  requests:
-                    storage: 50Gi
+          emptyDir: {}
       restartPolicy: Never
 EOT
-- 
GitLab


From 40e8a48d9a9585b7bfac3d2fa96e778ee428da36 Mon Sep 17 00:00:00 2001
From: Lia Domide <lia.domide@codemart.ro>
Date: Fri, 21 Mar 2025 04:43:01 +0100
Subject: [PATCH 10/13] fix(py-tvb-ext-xircuits): don't constrain
 py-tvb-widgets version

---
 packages/py-tvb-ext-xircuits/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/py-tvb-ext-xircuits/package.py b/packages/py-tvb-ext-xircuits/package.py
index 23bd0db6..5f3b5e79 100644
--- a/packages/py-tvb-ext-xircuits/package.py
+++ b/packages/py-tvb-ext-xircuits/package.py
@@ -38,7 +38,7 @@ class PyTvbExtXircuits(PythonPackage):
     depends_on('py-tvb-framework', type=("build", "run"))
     depends_on('py-tvb-ext-bucket', type=("build", "run"))
     depends_on('py-tvb-ext-unicore', type=("build", "run"))
-    depends_on('py-tvb-widgets@1.0:', type=("build", "run"))
+    depends_on('py-tvb-widgets', type=("build", "run"))
 
     depends_on('py-pytest', type='test')
 
-- 
GitLab


From 525385f3c688efee0a19ca253732f5a8b8a442ae Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Fri, 21 Mar 2025 05:01:07 +0100
Subject: [PATCH 11/13] feat(CI): generate script that loads jupyter extensions

After each lab build job, generate a script that loads any jupyter extensions in the current env. The script will be used on Lab startup.
---
 .gitlab-ci.yml              | 11 ++++++
 create_job_widget_script.sh | 68 +++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 create_job_widget_script.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e8524909..60be5dfd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,10 +4,12 @@ stages:
 
 variables:
   BUILD_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/ebrains-spack-build-env/base:devel
+  RUN_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/clb-jupyter-image/ebrains:dev-a7ab31be 
   SPACK_PATH_GITLAB: /mnt/spack_v0.23.1
   SYSTEMNAME: ebrainslab
   GIT_SUBMODULE_STRATEGY: recursive
   GIT_CLEAN_FLAGS: -ffdxq
+  RUNNER_AFTER_SCRIPT_TIMEOUT: 20
 
 # ===================================================================
 # LAB DEPLOYMENTS
@@ -47,6 +49,15 @@ variables:
     - if [ $(kubectl get pods -l job-name=simplejob${CI_PIPELINE_ID} -o jsonpath='{.items[0].status.containerStatuses[0].state.terminated.exitCode}') -ne 0 ]; then exit 1; fi;
     # delete the job, as we have the logs here
     - kubectl delete job simplejob${CI_PIPELINE_ID} || true
+  after_script:
+    - kubectl config use-context $KUBE_CONTEXT
+    - sh create_job_widget_script.sh $CI_PIPELINE_ID $RUN_ENV_DOCKER_IMAGE $INSTALLATION_ROOT $SPACK_ENV $RELEASE_NAME $LAB_KERNEL_ROOT
+    - cat widget-script.yml
+    - kubectl create -f widget-script.yml
+    - while true; do sleep 300; x=$(kubectl get pods -l job-name=widget-script${CI_PIPELINE_ID} -o jsonpath='{.items[0].status.phase}'); if [ $x != "Running" ]; then break; fi; done
+    - kubectl logs jobs/widget-script${CI_PIPELINE_ID} | tee log.txt
+    - if [ $(kubectl get pods -l job-name=widget-script${CI_PIPELINE_ID} -o jsonpath='{.items[0].status.containerStatuses[0].state.terminated.exitCode}') -ne 0 ]; then exit 1; fi;
+    - kubectl delete job widget-script${CI_PIPELINE_ID} || true
   # artifacts:
   #   paths:
   #     - spack_logs
diff --git a/create_job_widget_script.sh b/create_job_widget_script.sh
new file mode 100644
index 00000000..4bc5c613
--- /dev/null
+++ b/create_job_widget_script.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+# ===========================================================================================================
+# title         : create_job_widget_script.sh
+# usage         : ./create_job_widget_script.sh $OC_JOB_ID $RUN_ENV_DOCKER_IMAGE $INSTALLATION_ROOT
+#                 $SPACK_ENV $RELEASE_NAME $LAB_KERNEL_ROOT
+# description   : creates job file that generates a script to load the jupyter extensions for a given env
+# ===========================================================================================================
+
+OC_JOB_ID=$1
+RUN_ENV_DOCKER_IMAGE=$2
+INSTALLATION_ROOT=$3
+EBRAINS_SPACK_ENV=$4
+RELEASE_NAME=$5
+LAB_KERNEL_ROOT=$6
+
+cat <<EOT >> widget-script.yml
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: widget-script${OC_JOB_ID}
+spec:
+  parallelism: 1
+  completions: 1
+  backoffLimit: 0
+  template:
+    spec:
+      containers:
+      - name: widget-script
+        image: ${RUN_ENV_DOCKER_IMAGE}
+        imagePullPolicy: Always
+        resources:
+          limits:
+            cpu: '1'
+            memory: '1Gi'
+          requests:
+            cpu: '0.5'
+            memory: '500Mi'
+        volumeMounts:
+          - name: sharedbin
+            mountPath: /srv
+        command:
+        - /bin/bash
+        - -c
+        - |
+          . \$INSTALLATION_ROOT/spack/share/spack/setup-env.sh
+          spack env activate --without-view \$EBRAINS_SPACK_ENV
+          KERNEL_PATH=\$LAB_KERNEL_ROOT/\$(echo "\$RELEASE_NAME" | tr '[:upper:]' '[:lower:]')
+          spack load --sh py-tvb-ext-bucket py-tvb-ext-unicore py-tvb-ext-xircuits > \$KERNEL_PATH/bin/widget_activation.sh
+        env:
+          - name: SYSTEMNAME
+            value: ebrainslab
+          - name: SPACK_DISABLE_LOCAL_CONFIG
+            value: "true"
+          - name: INSTALLATION_ROOT
+            value: "$INSTALLATION_ROOT"
+          - name: EBRAINS_SPACK_ENV
+            value: "$EBRAINS_SPACK_ENV"
+          - name: RELEASE_NAME
+            value: "$RELEASE_NAME"
+          - name: LAB_KERNEL_ROOT
+            value: "$LAB_KERNEL_ROOT"
+      volumes:
+        - name: sharedbin
+          persistentVolumeClaim:
+            claimName: shared-binaries
+      restartPolicy: Never
+EOT
-- 
GitLab


From eef86e890ee3ed4cb01dbe5d83473888a304a33d Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Fri, 21 Mar 2025 05:15:44 +0000
Subject: [PATCH 12/13] fix(CI): revert deactivating view during concretization
 and installation

when deactivating the view, it is deleted, which is problematic in
production deployments
---
 install_spack_env.sh | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/install_spack_env.sh b/install_spack_env.sh
index 41a6526a..a0ed1f67 100644
--- a/install_spack_env.sh
+++ b/install_spack_env.sh
@@ -96,9 +96,6 @@ cp /tmp/spack.yaml ${CI_SPACK_ROOT}/var/spack/environments/$EBRAINS_SPACK_ENV/
 # activate environment
 spack env activate --without-view $EBRAINS_SPACK_ENV
 
-# deactivate view during concretization and installation
-spack env view disable
-
 spack concretize --force --fresh --test root
 
 # dump dag to file
@@ -147,10 +144,6 @@ fi
 # delay exit code until we have updated the cache below
 spack install --no-check-signature -y -j$SPACK_JOBS --fresh --test root && spack_install_ret=$? || spack_install_ret=$?
 
-# re-enable view
-spack env view enable
-spack env view regenerate
-
 # no need to update the local cache nor the remote cache if we don't want to update
 if [ -n "${OCI_CACHE_PREFIX}" ] && [ "${UPDATE_SPACK_OCI_CACHES:-false}" = "true" ]; then
     # push previously missing (but now installed) packages to the local cache
-- 
GitLab


From 83480fa1472bcfb173bbf92cb9d559a527253d99 Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Fri, 21 Mar 2025 05:40:16 +0000
Subject: [PATCH 13/13] fix(CI): adjust kernel creation script to new Python
 version

---
 create_JupyterLab_kernel.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/create_JupyterLab_kernel.sh b/create_JupyterLab_kernel.sh
index 0f02e121..76999595 100644
--- a/create_JupyterLab_kernel.sh
+++ b/create_JupyterLab_kernel.sh
@@ -37,7 +37,7 @@ cp $INSTALLATION_ROOT/spack/var/spack/environments/$EBRAINS_SPACK_ENV/load_env.s
 # and the location of python modules installed in the base docker Collab image
 cat <<EOF >> $KERNEL_PATH/bin/env.sh
 export PATH=\$PATH:/opt/app-root/src/.local/bin
-export PYTHONPATH=\$PYTHONPATH:/opt/app-root/src/.local/lib/python3.8/site-packages:/usr/local/lib/python3.8/dist-packages
+export PYTHONPATH=\$PYTHONPATH:/opt/conda/lib/python3.11/site-packages
 export R_LIBS_USER=/opt/app-root/src/.local/lib/R/site-library
 mkdir -p \$R_LIBS_USER
 export R_LIBS=\$R_LIBS_USER:\$R_LIBS
-- 
GitLab