add observer_cruise_id to SkyvernContext and logs (#1469)

This commit is contained in:
Shuchang Zheng
2025-01-02 12:49:48 -08:00
committed by GitHub
parent 3835f3ce69
commit b9d3228f77
3 changed files with 7 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ class SkyvernContext:
task_id: str | None = None
workflow_id: str | None = None
workflow_run_id: str | None = None
observer_cruise_id: str | None = None
max_steps_override: int | None = None
tz_info: ZoneInfo | None = None
totp_codes: dict[str, str | None] = field(default_factory=dict)

View File

@@ -32,6 +32,8 @@ def add_kv_pairs_to_msg(logger: logging.Logger, method_name: str, event_dict: Ev
event_dict["workflow_id"] = context.workflow_id
if context.workflow_run_id:
event_dict["workflow_run_id"] = context.workflow_run_id
if context.observer_cruise_id:
event_dict["observer_cruise_id"] = context.observer_cruise_id
# Add env to the log
event_dict["env"] = settings.ENV

View File

@@ -84,6 +84,10 @@ async def initialize_observer_cruise(
prompt=user_prompt,
organization_id=organization.organization_id,
)
# set observer cruise id in context
context = skyvern_context.current()
if context:
context.observer_cruise_id = observer_cruise.observer_cruise_id
observer_thought = await app.DATABASE.create_observer_thought(
observer_cruise_id=observer_cruise.observer_cruise_id,