-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed Up Publishing Times #1120
base: develop
Are you sure you want to change the base?
Changes from all commits
2c10272
4a8c792
4bca62d
8dae70a
b2e84b2
724e206
8721824
3119766
236f728
284ad53
8c9c69e
42760fb
ef850b5
9c67bf1
b172209
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,7 +1,15 @@ | ||||||||
import os | ||||||||
import copy | ||||||||
import errno | ||||||||
import itertools | ||||||||
import shutil | ||||||||
import sys | ||||||||
from concurrent.futures import ThreadPoolExecutor | ||||||||
# this is needed until speedcopy for linux is fixed | ||||||||
if sys.platform == "win32": | ||||||||
from speedcopy import copyfile | ||||||||
else: | ||||||||
from shutil import copyfile | ||||||||
Comment on lines
+8
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is copied from here. However, we're also using
Which may hint that either the fallback is redundant nowadays - or we have other areas in the codebase that are potentially buggy on Linux? @iLLiCiTiT @antirotor do you know? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Speedcopy is in dependencies of AYON ( ayon-core/client/pyproject.toml Line 10 in c7899fb
|
||||||||
|
||||||||
import clique | ||||||||
import pyblish.api | ||||||||
|
@@ -13,6 +21,7 @@ | |||||||
from ayon_api.utils import create_entity_id | ||||||||
|
||||||||
from ayon_core.lib import create_hard_link, source_hash | ||||||||
from ayon_core.lib.file_transaction import as_completed_stop_and_raise_on_error | ||||||||
from ayon_core.pipeline.publish import ( | ||||||||
get_publish_template_name, | ||||||||
OptionalPyblishPluginMixin, | ||||||||
|
@@ -415,11 +424,14 @@ def integrate_instance( | |||||||
# Copy(hardlink) paths of source and destination files | ||||||||
# TODO should we *only* create hardlinks? | ||||||||
# TODO should we keep files for deletion until this is successful? | ||||||||
for src_path, dst_path in src_to_dst_file_paths: | ||||||||
self.copy_file(src_path, dst_path) | ||||||||
|
||||||||
for src_path, dst_path in other_file_paths_mapping: | ||||||||
self.copy_file(src_path, dst_path) | ||||||||
with ThreadPoolExecutor(max_workers=8) as executor: | ||||||||
futures = [ | ||||||||
executor.submit(self.copy_file, src_path, dst_path) | ||||||||
for src_path, dst_path | ||||||||
in itertools.chain(src_to_dst_file_paths, | ||||||||
other_file_paths_mapping) | ||||||||
] | ||||||||
as_completed_stop_and_raise_on_error(executor, futures) | ||||||||
|
||||||||
# Update prepared representation etity data with files | ||||||||
# and integrate it to server. | ||||||||
|
@@ -648,7 +660,7 @@ def copy_file(self, src_path, dst_path): | |||||||
src_path, dst_path | ||||||||
)) | ||||||||
|
||||||||
shutil.copy(src_path, dst_path) | ||||||||
copyfile(src_path, dst_path) | ||||||||
|
||||||||
def version_from_representations(self, project_name, repres): | ||||||||
for repre in repres: | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this runs in a thread now - and hence it should not do this on an object outside of the thread. However, in Python implementations this should still be safe due to the GIL and how the interpreter locks, etc.
Nonetheless, in a potential non-GIL or free threaded Python 3 world this would be unsafe and instead we should be instead relying on the
future.result()
instead.