Skip to content

Commit

Permalink
Add a Record.__str__ method
Browse files Browse the repository at this point in the history
  • Loading branch information
MattToast committed Oct 17, 2024
1 parent f72e003 commit 831b9d4
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions smartsim/launchable/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import typing as t
from copy import deepcopy
import textwrap

from smartsim._core.commands.launch_commands import LaunchCommands
from smartsim._core.utils.helpers import check_name
Expand All @@ -51,11 +52,11 @@ class Job(BaseJob):
"""

def __init__(
self,
entity: SmartSimEntity,
launch_settings: LaunchSettings,
name: str | None = None,
):
self,
entity: SmartSimEntity,
launch_settings: LaunchSettings,
name: str | None = None,
):
"""Initialize a ``Job``
Jobs require a SmartSimEntity and a LaunchSettings. Optionally, users may provide
Expand Down Expand Up @@ -191,3 +192,12 @@ def job(self) -> Job:
:returns: A deep copy of the launched job.
"""
return deepcopy(self._job)

def __str__(self) -> str:
return textwrap.dedent(f"""\
Launch Record:
Launched Job ID:
{self.launched_id}
Laucnehd Job:
{textwrap.indent(str(job), " ")}
""")

0 comments on commit 831b9d4

Please sign in to comment.