Skip to content

Commit

Permalink
Adding comments
Browse files Browse the repository at this point in the history
  • Loading branch information
EmanElsaban committed Jan 17, 2025
1 parent cde91b1 commit 27938cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tron/core/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ def serialize_namedtuple(obj):
return obj

try:
# NOTE: you'll notice that there's a lot of get() accesses of state_data for
# pretty common fields - this is because ActionCommandConfig is used by more
# than one type of ActionRun (Kubernetes, Mesos, SSH) and these generally look
# different. Alternatively, some of these fields are used by KubernetesActionRun
# but are relatively new and older runs do not have data for them.
# Once we get rid of the SSH and Mesos code as well as older runs in DynamoDB,
# we'll likely be able to clean this up.
return json.dumps(
{
"command": state_data["command"],
Expand Down
5 changes: 5 additions & 0 deletions tron/core/actionrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ def to_json(state_data: dict) -> Optional[str]:
"end_time": state_data["end_time"].isoformat() if state_data["end_time"] else None,
"rendered_command": state_data["rendered_command"],
"exit_status": state_data["exit_status"],
# NOTE: mesos_task_id can be deleted once we delete all Mesos
# code and run data - and kubernetes_task_id can then be
# accessed unconditionally :)
# (see note in ActionCommandConfig::to_json() for more
# information about why we do this)
"mesos_task_id": state_data.get("mesos_task_id"),
"kubernetes_task_id": state_data.get("kubernetes_task_id"),
}
Expand Down

0 comments on commit 27938cb

Please sign in to comment.