Skip to content
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ local_settings.py

seatable-python-runner/
seatable-python-runner.zip

.python-version
16 changes: 14 additions & 2 deletions scheduler/app/faas_scheduler/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ class ScriptLog(Base):
return_code = Column(Integer, nullable=True)
output = Column(Text, nullable=True)
operate_from = Column(String(255))
state = Column(String(10))
created_at = Column(DateTime, index=True)

PENDING = "pending"
RUNNING = "running"
FINISHED = "finished"

def __init__(
self,
Expand All @@ -39,15 +45,17 @@ def __init__(
org_id,
script_name,
context_data,
started_at,
state,
created_at,
operate_from=None,
):
self.dtable_uuid = dtable_uuid
self.owner = owner
self.org_id = org_id
self.script_name = script_name
self.context_data = context_data
self.started_at = started_at
self.state = state
self.created_at = created_at
self.operate_from = operate_from

def to_dict(self, include_context_data=True, include_output=True):
Expand All @@ -57,13 +65,17 @@ def to_dict(self, include_context_data=True, include_output=True):
"id": self.id,
"dtable_uuid": self.dtable_uuid,
"owner": self.owner,
"org_id": self.org_id,
"script_name": self.script_name,
"started_at": datetime_to_isoformat_timestr(self.started_at),
"finished_at": self.finished_at
and datetime_to_isoformat_timestr(self.finished_at),
"success": self.success,
"return_code": self.return_code,
"operate_from": self.operate_from,
"state": self.state,
"created_at": self.created_at
and datetime_to_isoformat_timestr(self.created_at),
}

if include_context_data:
Expand Down
Loading