Create subjobs after submission - #54 (#79)

* Force start in render queue only starts NOT_STARTED and SCHEDULED jobs

* Refactor adding jobs / subjobs

* Remove dead code

* Fixed issue with bulk job submission

* Cancel job now cancels all subjobs

* Misc fixes

* JSON now returns job hostname

* Add hostname as optional column in DB

* Misc fixes

* Error handling for removing zip file after download

* Clean up imports

* Fixed issue where worker child information would not be saved
This commit is contained in:
2024-07-30 19:22:38 -05:00
committed by GitHub
parent 6d33f262b3
commit 8a3e74660c
8 changed files with 138 additions and 142 deletions

View File

@@ -11,6 +11,7 @@ import psutil
from pubsub import pub
from sqlalchemy import Column, Integer, String, DateTime, JSON
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.mutable import MutableDict
from src.utilities.misc_helper import get_time_elapsed
from src.utilities.status_utils import RenderStatus, string_to_status
@@ -23,6 +24,7 @@ class BaseRenderWorker(Base):
__tablename__ = 'render_workers'
id = Column(String, primary_key=True)
hostname = Column(String, nullable=True)
input_path = Column(String)
output_path = Column(String)
date_created = Column(DateTime)
@@ -36,7 +38,7 @@ class BaseRenderWorker(Base):
start_frame = Column(Integer)
end_frame = Column(Integer, nullable=True)
parent = Column(String, nullable=True)
children = Column(JSON)
children = Column(MutableDict.as_mutable(JSON))
name = Column(String)
file_hash = Column(String)
_status = Column(String)
@@ -60,6 +62,7 @@ class BaseRenderWorker(Base):
# Essential Info
self.id = generate_id()
self.hostname = None
self.input_path = input_path
self.output_path = output_path
self.args = args or {}
@@ -85,7 +88,7 @@ class BaseRenderWorker(Base):
self.end_time = None
# History
self.status = RenderStatus.CONFIGURING
self.status = RenderStatus.NOT_STARTED
self.warnings = []
self.errors = []
@@ -306,6 +309,7 @@ class BaseRenderWorker(Base):
job_dict = {
'id': self.id,
'name': self.name,
'hostname': self.hostname,
'input_path': self.input_path,
'output_path': self.output_path,
'priority': self.priority,

View File

@@ -208,7 +208,7 @@ class EngineManager:
worker_class = cls.engine_with_name(renderer).worker_class()
# check to make sure we have versions installed
all_versions = EngineManager.all_versions_for_engine(renderer)
all_versions = cls.all_versions_for_engine(renderer)
if not all_versions:
raise FileNotFoundError(f"Cannot find any installed {renderer} engines")
@@ -222,7 +222,7 @@ class EngineManager:
# Download the required engine if not found locally
if not engine_path:
download_result = EngineManager.download_engine(renderer, engine_version)
download_result = cls.download_engine(renderer, engine_version)
if not download_result:
raise FileNotFoundError(f"Cannot download requested version: {renderer} {engine_version}")
engine_path = download_result['path']