Skip to content

Add job_def_type for logging appdef vs pipedef to torchxevent #1089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion torchx/runner/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from torchx.runner.events.handlers import get_logging_handler
from torchx.util.session import get_session_id_or_create_new

from .api import SourceType, TorchxEvent # noqa F401
from .api import JobDefType, SourceType, TorchxEvent # noqa F401

# pyre-fixme[9]: _events_logger is a global variable
_events_logger: logging.Logger = None
Expand Down Expand Up @@ -88,6 +88,7 @@ def __init__(
app_id: Optional[str] = None,
app_image: Optional[str] = None,
app_metadata: Optional[Dict[str, str]] = None,
job_def_type: JobDefType = JobDefType.AppDef,
runcfg: Optional[str] = None,
workspace: Optional[str] = None,
) -> None:
Expand All @@ -97,6 +98,7 @@ def __init__(
app_id,
app_image=app_image,
app_metadata=app_metadata,
job_def_type=job_def_type,
runcfg=runcfg,
workspace=workspace,
)
Expand Down Expand Up @@ -148,6 +150,7 @@ def _generate_torchx_event(
app_id: Optional[str] = None,
app_image: Optional[str] = None,
app_metadata: Optional[Dict[str, str]] = None,
job_def_type: JobDefType = JobDefType.AppDef,
runcfg: Optional[str] = None,
source: SourceType = SourceType.UNKNOWN,
workspace: Optional[str] = None,
Expand All @@ -159,6 +162,7 @@ def _generate_torchx_event(
app_id=app_id,
app_image=app_image,
app_metadata=app_metadata,
job_def_type=job_def_type,
runcfg=runcfg,
source=source,
workspace=workspace,
Expand Down
7 changes: 7 additions & 0 deletions torchx/runner/events/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class SourceType(str, Enum):
EXTERNAL = "EXTERNAL"


class JobDefType(str, Enum):
AppDef = "AppDef"
PipeDef = "PipeDef"


@dataclass
class TorchxEvent:
"""
Expand All @@ -37,6 +42,7 @@ class TorchxEvent:
wall_time_usec: Wall time spent in usec
start_epoch_time_usec: Epoch time in usec when runner event starts
Workspace: Track how different workspaces/no workspace affects build and scheduler
job_def_type: Type of the job definition (i.e AppDef)
"""

session: str
Expand All @@ -55,6 +61,7 @@ class TorchxEvent:
exception_type: Optional[str] = None
exception_message: Optional[str] = None
exception_source_location: Optional[str] = None
job_def_type: JobDefType = JobDefType.AppDef

def __str__(self) -> str:
return self.serialize()
Expand Down
Loading