mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 08:48:13 +00:00
Persist args in db and return args in job json (#82)
This commit is contained in:
@@ -62,7 +62,7 @@ def jobs_json():
|
|||||||
return {'jobs': all_jobs, 'token': job_cache_token}
|
return {'jobs': all_jobs, 'token': job_cache_token}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(f"Exception fetching jobs_json: {e}")
|
logger.exception(f"Exception fetching jobs_json: {e}")
|
||||||
return [], 500
|
return {}, 500
|
||||||
|
|
||||||
|
|
||||||
@server.get('/api/jobs_long_poll')
|
@server.get('/api/jobs_long_poll')
|
||||||
@@ -76,11 +76,11 @@ def long_polling_jobs():
|
|||||||
return all_jobs
|
return all_jobs
|
||||||
# Break after 30 seconds to avoid gateway timeout
|
# Break after 30 seconds to avoid gateway timeout
|
||||||
if time.time() - start_time > 30:
|
if time.time() - start_time > 30:
|
||||||
return [], 204
|
return {}, 204
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(f"Exception fetching long_polling_jobs: {e}")
|
logger.exception(f"Exception fetching long_polling_jobs: {e}")
|
||||||
return [], 500
|
return {}, 500
|
||||||
|
|
||||||
|
|
||||||
@server.route('/api/job/<job_id>/thumbnail')
|
@server.route('/api/job/<job_id>/thumbnail')
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class BaseRenderWorker(Base):
|
|||||||
end_frame = Column(Integer, nullable=True)
|
end_frame = Column(Integer, nullable=True)
|
||||||
parent = Column(String, nullable=True)
|
parent = Column(String, nullable=True)
|
||||||
children = Column(MutableDict.as_mutable(JSON))
|
children = Column(MutableDict.as_mutable(JSON))
|
||||||
|
args = Column(MutableDict.as_mutable(JSON))
|
||||||
name = Column(String)
|
name = Column(String)
|
||||||
file_hash = Column(String)
|
file_hash = Column(String)
|
||||||
_status = Column(String)
|
_status = Column(String)
|
||||||
@@ -288,6 +289,8 @@ class BaseRenderWorker(Base):
|
|||||||
self.status = RenderStatus.CANCELLED
|
self.status = RenderStatus.CANCELLED
|
||||||
|
|
||||||
def percent_complete(self):
|
def percent_complete(self):
|
||||||
|
if self.status == RenderStatus.COMPLETED:
|
||||||
|
return 1.0
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def _parse_stdout(self, line):
|
def _parse_stdout(self, line):
|
||||||
@@ -329,7 +332,8 @@ class BaseRenderWorker(Base):
|
|||||||
'end_frame': self.end_frame,
|
'end_frame': self.end_frame,
|
||||||
'total_frames': self.total_frames,
|
'total_frames': self.total_frames,
|
||||||
'last_output': getattr(self, 'last_output', None),
|
'last_output': getattr(self, 'last_output', None),
|
||||||
'log_path': self.log_path()
|
'log_path': self.log_path(),
|
||||||
|
'args': self.args
|
||||||
}
|
}
|
||||||
|
|
||||||
# convert to json and back to auto-convert dates to iso format
|
# convert to json and back to auto-convert dates to iso format
|
||||||
|
|||||||
Reference in New Issue
Block a user