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)