changeset 2:79160beab2a4 draft

planemo upload for repository https://github.com/afgane/gcp_batch_netcat
author enis
date Tue, 15 Jul 2025 21:10:05 +0000
parents cd36336ffaf6
children 0ea626b10557
files gcp_batch_netcat.py gcp_batch_netcat.xml
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gcp_batch_netcat.py	Tue Jul 15 14:55:51 2025 +0000
+++ b/gcp_batch_netcat.py	Tue Jul 15 21:10:05 2025 +0000
@@ -3,6 +3,8 @@
 import subprocess
 import argparse
 import uuid
+import time
+import os
 
 def main():
     parser = argparse.ArgumentParser()
@@ -11,8 +13,12 @@
     parser.add_argument('--project', required=True)
     parser.add_argument('--region', required=True)
     parser.add_argument('--port', default='2049')
+    parser.add_argument('--service_account_key', required=True)
     args = parser.parse_args()
 
+    # Set up authentication using the service account key
+    os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = args.service_account_key
+
     job_name = f'netcat-job-{uuid.uuid4()}'
 
     job_spec = {
@@ -48,6 +54,9 @@
         '--format=text'
     ]
 
+    # Wait 4 minutes before submitting the job
+    time.sleep(240)
+
     try:
         result = subprocess.run(command, capture_output=True, text=True, check=True)
         with open(args.output, 'w') as f:
--- a/gcp_batch_netcat.xml	Tue Jul 15 14:55:51 2025 +0000
+++ b/gcp_batch_netcat.xml	Tue Jul 15 21:10:05 2025 +0000
@@ -6,13 +6,14 @@
         <container type="docker">afgane/gcp-batch-netcat:0.1.0</container>
     </requirements>
     <command><![CDATA[
-python3 '$__tool_directory__/gcp_batch_netcat.py' --nfs_address '$nfs_address' --output '$output' --project '$project' --region '$region' --port '$port'
+python3 '$__tool_directory__/gcp_batch_netcat.py' --nfs_address '$nfs_address' --output '$output' --project '$project' --region '$region' --port '$port' --service_account_key '$service_account_key'
     ]]></command>
     <inputs>
         <param name="nfs_address" type="text" label="NFS Server Address" optional="false"/>
         <param name="project" type="text" label="GCP Project ID" optional="false"/>
         <param name="region" type="text" label="GCP Region" optional="false"/>
         <param name="port" type="integer" value="2049" label="Port"/>
+        <param name="service_account_key" type="data" format="json" label="GCP Service Account Key File" help="JSON key file for GCP service account with Batch API permissions"/>
     </inputs>
     <outputs>
         <data name="output" format="txt"/>