Skip to content

Commit 9920ed0

Browse files
bobyangyffacebook-github-bot
authored andcommitted
Add job_def_type for logging appdef vs pipedef to torchxevent
Differential Revision: D72684562
1 parent 7fabab4 commit 9920ed0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

torchx/runner/events/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from torchx.runner.events.handlers import get_logging_handler
3232
from torchx.util.session import get_session_id_or_create_new
3333

34-
from .api import SourceType, TorchxEvent # noqa F401
34+
from .api import JobDefType, SourceType, TorchxEvent # noqa F401
3535

3636
# pyre-fixme[9]: _events_logger is a global variable
3737
_events_logger: logging.Logger = None
@@ -88,6 +88,7 @@ def __init__(
8888
app_id: Optional[str] = None,
8989
app_image: Optional[str] = None,
9090
app_metadata: Optional[Dict[str, str]] = None,
91+
job_def_type: JobDefType = JobDefType.AppDef,
9192
runcfg: Optional[str] = None,
9293
workspace: Optional[str] = None,
9394
) -> None:
@@ -97,6 +98,7 @@ def __init__(
9798
app_id,
9899
app_image=app_image,
99100
app_metadata=app_metadata,
101+
job_def_type=job_def_type,
100102
runcfg=runcfg,
101103
workspace=workspace,
102104
)
@@ -148,6 +150,7 @@ def _generate_torchx_event(
148150
app_id: Optional[str] = None,
149151
app_image: Optional[str] = None,
150152
app_metadata: Optional[Dict[str, str]] = None,
153+
job_def_type: JobDefType = JobDefType.AppDef,
151154
runcfg: Optional[str] = None,
152155
source: SourceType = SourceType.UNKNOWN,
153156
workspace: Optional[str] = None,
@@ -159,6 +162,7 @@ def _generate_torchx_event(
159162
app_id=app_id,
160163
app_image=app_image,
161164
app_metadata=app_metadata,
165+
job_def_type=job_def_type,
162166
runcfg=runcfg,
163167
source=source,
164168
workspace=workspace,

torchx/runner/events/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ class SourceType(str, Enum):
1919
EXTERNAL = "EXTERNAL"
2020

2121

22+
class JobDefType(str, Enum):
23+
AppDef = "AppDef"
24+
PipeDef = "PipeDef"
25+
26+
2227
@dataclass
2328
class TorchxEvent:
2429
"""
@@ -37,6 +42,7 @@ class TorchxEvent:
3742
wall_time_usec: Wall time spent in usec
3843
start_epoch_time_usec: Epoch time in usec when runner event starts
3944
Workspace: Track how different workspaces/no workspace affects build and scheduler
45+
job_def_type: Type of the job definition (i.e AppDef)
4046
"""
4147

4248
session: str
@@ -55,6 +61,7 @@ class TorchxEvent:
5561
exception_type: Optional[str] = None
5662
exception_message: Optional[str] = None
5763
exception_source_location: Optional[str] = None
64+
job_def_type: JobDefType = JobDefType.AppDef
5865

5966
def __str__(self) -> str:
6067
return self.serialize()

0 commit comments

Comments
 (0)