diff gcp_batch_netcat.py @ 10:cdfa2e1a7ef4 draft

planemo upload for repository https://github.com/afgane/gcp_batch_netcat commit 4af8133734db9edb3cb94326a82cdaa484e96482-dirty
author enis
date Tue, 12 Aug 2025 16:22:41 +0000
parents 3fd12035e6c9
children fe0bf22037a5
line wrap: on
line diff
--- a/gcp_batch_netcat.py	Sun Aug 10 21:32:04 2025 +0000
+++ b/gcp_batch_netcat.py	Tue Aug 12 16:22:41 2025 +0000
@@ -89,7 +89,7 @@
 echo "Timestamp: $(date)"
 echo "Container hostname: $(hostname)"
 echo "Host VM Image: galaxy-k8s-boot-v2025-08-10"
-echo "Container Image: afgane/gcp-batch-netcat:0.2.0"
+echo "Container Image: afgane/gcp-batch-netcat:0.3.0"
 echo ""
 
 # Basic system info
@@ -307,13 +307,11 @@
     logger.info("Building job specification...")
     runnable = batch_v1.Runnable()
     runnable.container = batch_v1.Runnable.Container()
-    runnable.container.image_uri = "afgane/gcp-batch-netcat:0.2.0"
+    runnable.container.image_uri = "afgane/gcp-batch-netcat:0.3.0"
 
     # Bind mount /cvmfs from the host VM (which has CVMFS client) into the container
-    cvmfs_volume = batch_v1.Volume()
-    cvmfs_volume.host_path = "/cvmfs"
-    cvmfs_volume.mount_path = "/cvmfs"
-    runnable.container.volumes = [cvmfs_volume]
+    # Use the docker-style volume syntax for bind mounting host paths
+    runnable.container.volumes = ["/cvmfs:/cvmfs:ro"]
 
     runnable.container.entrypoint = "/bin/bash"
     runnable.container.commands = ["-c", test_script]
@@ -350,9 +348,13 @@
     instance_policy.boot_disk.size_gb = 99
     logger.debug(f"Using custom VM image: {instance_policy.boot_disk.image}")
 
+    # Wrap the instance policy in InstancePolicyOrTemplate
+    instance_policy_or_template = batch_v1.AllocationPolicy.InstancePolicyOrTemplate()
+    instance_policy_or_template.policy = instance_policy
+
     allocation_policy = batch_v1.AllocationPolicy()
     allocation_policy.network = network_policy
-    allocation_policy.instances = [instance_policy]
+    allocation_policy.instances = [instance_policy_or_template]
 
     job = batch_v1.Job()
     job.task_groups = [task_group]