add observer_cruise_id to SkyvernContext and logs (#1469)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user