Don't create BAT pack when rendering file in job storage directory

When the to-be-rendered blend file is contained in the job storage
directory, it is now assumed that all files are already reachable by the
Flamenco Workers. This supports environments working directly on shared
storage.

This assumes that the paths are already correct for the Flamenco
Workers. No detection of missing files is done (as BAT doesn't run).
This commit is contained in:
Sybren A. Stüvel 2019-10-25 13:34:34 +02:00
parent db30b3df76
commit 379580de86
2 changed files with 34 additions and 0 deletions

View File

@ -1,5 +1,11 @@
# Blender Cloud changelog # Blender Cloud changelog
## Version 1.15 (in development)
- Avoid creating BAT pack when the to-be-rendered file is already inside the job storage
directory. This assumes that the paths are already correct for the Flamenco Workers.
## Version 1.14 (2019-10-10) ## Version 1.14 (2019-10-10)
- Upgraded BAT to 1.2 for missing smoke caches, compatibility with Blender 2.81, and some - Upgraded BAT to 1.2 for missing smoke caches, compatibility with Blender 2.81, and some

View File

@ -240,6 +240,23 @@ def guess_output_file_extension(output_format: str, scene) -> str:
return '.' + container.lower() return '.' + container.lower()
def is_file_inside_job_storage(prefs, current_file: Path) -> bool:
"""Check whether current blend file is inside the storage path.
:return: True when 'current_file' is inside the Flamenco
job storage directory already. In this case it won't be
BAT-packed, as it's assumed the job storage dir is
accessible by the workers already.
"""
flamenco_job_file_path = Path(prefs.flamenco_job_file_path).absolute().resolve()
current_file = current_file.absolute().resolve()
try:
current_file.relative_to(flamenco_job_file_path)
except ValueError:
return False
return True
@compatibility.convert_properties @compatibility.convert_properties
class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin, class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
pillar.AuthenticatedPillarOperatorMixin, pillar.AuthenticatedPillarOperatorMixin,
@ -596,6 +613,11 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
outfile = PurePath('{shaman}') / outfile outfile = PurePath('{shaman}') / outfile
return None, outfile, missing_sources return None, outfile, missing_sources
if is_file_inside_job_storage(prefs, filepath):
# The blend file is contained in the job storage path, no need to copy anything.
# Since BAT doesn't run, we also don't know whether files are missing.
return filepath.parent, filepath, []
# Create a unique directory that is still more or less identifyable. # Create a unique directory that is still more or less identifyable.
# This should work better than a random ID. # This should work better than a random ID.
unique_dir = '%s-%s-%s' % (datetime.now().isoformat('-').replace(':', ''), unique_dir = '%s-%s-%s' % (datetime.now().isoformat('-').replace(':', ''),
@ -1043,6 +1065,12 @@ class FLAMENCO_PT_render(bpy.types.Panel, FlamencoPollMixin):
text='', icon='DISK_DRIVE') text='', icon='DISK_DRIVE')
props.path = prefs.flamenco_job_file_path props.path = prefs.flamenco_job_file_path
if is_file_inside_job_storage(prefs, Path(context.blend_data.filepath)):
# File is contained in the job storage path, no need to copy anything.
paths_layout.label(text='Current file already in job storage path; '
'not going to create BAT pack.')
render_output = render_output_path(context) render_output = render_output_path(context)
if render_output is None: if render_output is None:
paths_layout.label(text='Unable to render with Flamenco, outside of project directory.') paths_layout.label(text='Unable to render with Flamenco, outside of project directory.')