diff gcp_batch_netcat.py @ 3:0ea626b10557 draft

planemo upload for repository https://github.com/afgane/gcp_batch_netcat
author enis
date Mon, 21 Jul 2025 15:13:09 +0000
parents 79160beab2a4
children 2ff4a39ea41b
line wrap: on
line diff
--- a/gcp_batch_netcat.py	Tue Jul 15 21:10:05 2025 +0000
+++ b/gcp_batch_netcat.py	Mon Jul 21 15:13:09 2025 +0000
@@ -19,6 +19,12 @@
     # Set up authentication using the service account key
     os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = args.service_account_key
 
+    # Ensure gcloud uses a writable config directory
+    os.environ['CLOUDSDK_CONFIG'] = '/tmp/gcloud-config'
+
+    # Create the temp config directory if it doesn't exist
+    os.makedirs('/tmp/gcloud-config', exist_ok=True)
+
     job_name = f'netcat-job-{uuid.uuid4()}'
 
     job_spec = {
@@ -28,10 +34,17 @@
                     "runnables": [
                         {
                             "script": {
-                                "text": f"nc -z -v {args.nfs_address} {args.port}"
+                                "text": f"/usr/bin/nc -z -v {args.nfs_address} {args.port}"
                             }
                         }
-                    ]
+                    ],
+                    "computeResource": {
+                        "cpuMilli": 1000,
+                        "memoryMib": 1024
+                    },
+                    "environment": {
+                        "imageUri": "afgane/gcp-batch-netcat:0.1.0"
+                    }
                 },
                 "taskCount": 1,
                 "parallelism": 1
@@ -51,7 +64,8 @@
         '--location', args.region,
         '--project', args.project,
         '--config', job_spec_file,
-        '--format=text'
+        '--format=text',
+        '--verbosity=debug'
     ]
 
     # Wait 4 minutes before submitting the job