Account for the instance of submodules.pack.Packer #104184

Merged
Sybren A. Stüvel merged 5 commits from Nitin-Rawat-1/flamenco:104183-Error-submitting-job into main 2023-02-17 11:06:08 +01:00
Showing only changes of commit 965b99546a - Show all commits

View File

@ -48,16 +48,10 @@ class MsgProgress(Message):
@dataclass
class MsgDone(Message):
output_path: Path
"""Path of the submitted blend file, relative to the Shaman checkout root."""
actual_checkout_path: PurePosixPath
"""Shaman checkout path, i.e. the root of the job files, relative to the Shaman checkout root."""
missing_files: list[Path]
@dataclass
class MsgDoneNotShaman(Message):
output_path: Path
missing_files: list[Path]
"""Path of the submitted blend file, relative to the Shaman checkout root."""
actual_checkout_path: Optional[PurePosixPath] = None
# MyPy doesn't understand the way BAT subpackages are imported.
@ -174,14 +168,12 @@ class PackThread(threading.Thread):
self._set_bat_status("DONE")
dr.sybren marked this conversation as resolved

I think the code can be simplified to:

msg = MsgDone(
    self.packer.output_path,
    self.packer.missing_files,
    getattr(self.packer, 'actual_checkout_path', None),
)

That way the entire if can go away, and it's no longer specific to a particular Packer implementation.

I think the code can be simplified to: ```py msg = MsgDone( self.packer.output_path, self.packer.missing_files, getattr(self.packer, 'actual_checkout_path', None), ) ``` That way the entire `if` can go away, and it's no longer specific to a particular `Packer` implementation.
if isinstance(self.packer, submodules.pack.Packer):
msg = MsgDoneNotShaman(
self.packer.output_path, self.packer.missing_files
)
msg = MsgDone(self.packer.output_path, self.packer.missing_files)
else:
msg = MsgDone(
self.packer.output_path,
self.packer.actual_checkout_path,
self.packer.missing_files,
self.packer.actual_checkout_path,
)
self.queue.put(msg)