This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
Standalone: settings improvements #3355
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
98646b9
standalone: adding rename shot switch and hierarchy switch
jakubjezek001 2da7261
standalone: ensure extension with dot at start
jakubjezek001 227553e
Merge branch 'develop' into bugfix/stpublisher-editorial-hierarchy
jakubjezek001 26dd198
Merge branch 'develop' into bugfix/stpublisher-editorial-hierarchy
iLLiCiTiT 68ee05b
filter representations before integration starts
iLLiCiTiT 7cb3812
moved reset of tranfers to the end of repre iteration
iLLiCiTiT 2b19e6c
Merge pull request #3398 from pypeclub/bugfix/filter_representations_…
iLLiCiTiT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,9 +145,43 @@ def process(self, instance): | |
if instance.data.get("farm"): | ||
return | ||
|
||
# Prepare repsentations that should be integrated | ||
repres = instance.data.get("representations") | ||
# Raise error if instance don't have any representations | ||
if not repres: | ||
raise ValueError( | ||
"Instance {} has no files to transfer".format( | ||
instance.data["family"] | ||
) | ||
) | ||
|
||
# Validate type of stored representations | ||
if not isinstance(repres, (list, tuple)): | ||
raise TypeError( | ||
"Instance 'files' must be a list, got: {0} {1}".format( | ||
str(type(repres)), str(repres) | ||
) | ||
) | ||
|
||
# Filter representations | ||
filtered_repres = [] | ||
for repre in repres: | ||
if "delete" in repre.get("tags", []): | ||
continue | ||
filtered_repres.append(repre) | ||
|
||
# Skip instance if there are not representations to integrate | ||
# all representations should not be integrated | ||
if not filtered_repres: | ||
self.log.warning(( | ||
"Skipping, there are no representations" | ||
" to integrate for instance {}" | ||
).format(instance.data["family"])) | ||
return | ||
|
||
self.integrated_file_sizes = {} | ||
try: | ||
self.register(instance) | ||
self.register(instance, filtered_repres) | ||
self.log.info("Integrated Asset in to the database ...") | ||
self.log.info("instance.data: {}".format(instance.data)) | ||
self.handle_destination_files(self.integrated_file_sizes, | ||
|
@@ -158,7 +192,7 @@ def process(self, instance): | |
self.handle_destination_files(self.integrated_file_sizes, 'remove') | ||
six.reraise(*sys.exc_info()) | ||
|
||
def register(self, instance): | ||
def register(self, instance, repres): | ||
# Required environment variables | ||
anatomy_data = instance.data["anatomyData"] | ||
|
||
|
@@ -236,18 +270,6 @@ def register(self, instance): | |
"Establishing staging directory @ {0}".format(stagingdir) | ||
) | ||
|
||
# Ensure at least one file is set up for transfer in staging dir. | ||
repres = instance.data.get("representations") | ||
repres = instance.data.get("representations") | ||
msg = "Instance {} has no files to transfer".format( | ||
instance.data["family"]) | ||
assert repres, msg | ||
assert isinstance(repres, (list, tuple)), ( | ||
"Instance 'files' must be a list, got: {0} {1}".format( | ||
str(type(repres)), str(repres) | ||
) | ||
) | ||
|
||
subset = self.get_subset(asset_entity, instance) | ||
instance.data["subsetEntity"] = subset | ||
|
||
|
@@ -270,7 +292,10 @@ def register(self, instance): | |
|
||
self.log.debug("Creating version ...") | ||
|
||
new_repre_names_low = [_repre["name"].lower() for _repre in repres] | ||
new_repre_names_low = [ | ||
_repre["name"].lower() | ||
for _repre in repres | ||
] | ||
|
||
existing_version = legacy_io.find_one({ | ||
'type': 'version', | ||
|
@@ -373,18 +398,8 @@ def register(self, instance): | |
if profile: | ||
template_name = profile["template_name"] | ||
|
||
|
||
|
||
published_representations = {} | ||
for idx, repre in enumerate(instance.data["representations"]): | ||
# reset transfers for next representation | ||
# instance.data['transfers'] is used as a global variable | ||
# in current codebase | ||
instance.data['transfers'] = list(orig_transfers) | ||
|
||
if "delete" in repre.get("tags", []): | ||
continue | ||
|
||
for idx, repre in enumerate(repres): | ||
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. Loop control variable 'idx' not used within the loop body. If this is intended, start the name with an underscore. |
||
published_files = [] | ||
|
||
# create template data for Anatomy | ||
|
@@ -662,6 +677,10 @@ def register(self, instance): | |
"published_files": published_files | ||
} | ||
self.log.debug("__ representations: {}".format(representations)) | ||
# reset transfers for next representation | ||
# instance.data['transfers'] is used as a global variable | ||
# in current codebase | ||
instance.data['transfers'] = list(orig_transfers) | ||
|
||
# Remove old representations if there are any (before insertion of new) | ||
if existing_repres: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
'IntegrateAssetNew.register' is too complex (52)