Skip to content

Commit

Permalink
MPM appname
Browse files Browse the repository at this point in the history
  • Loading branch information
kks32 committed Nov 26, 2024
1 parent 2eb2716 commit e911ce8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
39 changes: 12 additions & 27 deletions dapi/components/jobs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,18 @@ def app_method(
) -> Any:
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,
)
job_info = handler.generate_job_info(
self.tapis,
input_uri or "tapis://example/input/",
input_file,
job_name,
app_name,
max_minutes,
node_count,
cores_per_node,
queue,
allocation,
)

return job_info

Expand Down
5 changes: 5 additions & 0 deletions dapi/components/jobs/mpm_job_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
class MpmJobHandler(BaseJobHandler):
"""Custom handler for MPM (Material Point Method) jobs."""

def __init__(self):
"""Initialize with fixed mpm app name."""
super().__init__(default_app_name="mpm")

def generate_job_info(
self,
tapis_client,
input_uri: str,
input_file: str,
job_name: Optional[str] = None,
app_name: Optional[str] = None,
max_minutes: Optional[int] = None,
node_count: Optional[int] = None,
cores_per_node: Optional[int] = None,
Expand Down

0 comments on commit e911ce8

Please sign in to comment.