From 2eb2716edf3443558019111a764a5dd7cc7f036c Mon Sep 17 00:00:00 2001 From: Krishna Kumar Date: Tue, 26 Nov 2024 16:16:18 -0600 Subject: [PATCH] MPM doesn't need an appname --- dapi/components/jobs/__init__.py | 42 +++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/dapi/components/jobs/__init__.py b/dapi/components/jobs/__init__.py index 8aafef2..6ff7d2f 100644 --- a/dapi/components/jobs/__init__.py +++ b/dapi/components/jobs/__init__.py @@ -40,18 +40,36 @@ def app_method( queue: Optional[str] = None, allocation: Optional[str] = None, ) -> Any: - handler = self.handlers[app_name](app_name) - job_info = handler.generate_job_info( - self.tapis, - input_uri or "tapis://example/input/", - input_file, - job_name, - max_minutes, - node_count, - cores_per_node, - queue, - allocation, - ) + handler = self.handlers[app_name]() # Remove app_name from instantiation + + # Check if handler's generate_job_info expects app_name + if "app_name" in handler.generate_job_info.__code__.co_varnames: + job_info = handler.generate_job_info( + self.tapis, + input_uri or "tapis://example/input/", + input_file, + job_name, + app_name, # Pass app_name for handlers that expect it + max_minutes, + node_count, + cores_per_node, + queue, + allocation, + ) + else: + # For MPM-style handlers that don't expect app_name + job_info = handler.generate_job_info( + self.tapis, + input_uri or "tapis://example/input/", + input_file, + job_name, + max_minutes, + node_count, + cores_per_node, + queue, + allocation, + ) + return job_info setattr(self, app_name, app_method)