Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

#180 - Enrich tasks with additional information #516

Closed
wants to merge 11 commits into from

Conversation

kalisp
Copy link
Member

@kalisp kalisp commented Sep 15, 2020

Solves: pypeclub/pype/#180

Currently task info is stored in both project config and assets as list of task names only. This PR enhances it to list of dictionaries.

I kept both config and asset as LISTs to follow getavalon/core#556 and it felt wrong to have project.config.tasks as a dictionary and `asset.tasks' as a list.
Schemas already expect list of dictionaries, so no change is needed there.
(Could be changed easily if necessary.)

I added task name to short_name mapping. This short_name could be used in paths.. in the future.
project_task
asset_tasks

Requires:
pype-config:ynput/pype-config#81
avalon-core:ynput/avalon-core#196

These queries need to be run on MongoDB:

db.getCollection('YOUR_COLLECTION_NAME').updateMany({type:"project"}, {$set: {"config.tasks":""}})
db.getCollection('YOUR_COLLECTION_NAME').updateMany({type:"asset"}, {$set: {"data.tasks": ""}})

Tasks in project config or on assets were stored only as names. This changes them into dictionaries to enhance information that could be stored and used elsewhere later.
@kalisp kalisp self-assigned this Sep 22, 2020
Copy link
Member

@mkolar mkolar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this in detail and trying out using it and retrieving data in plugins and other places, I think we should re-structure both of these to be dictionaries, rather than lists.

With lists, we'll need to iterate and compare asset tasks against project task types everytime we need to assemble data for anatomy, which will be a major PITA. Switching to dict we could simply do
project_data["config"]["task_type"][asset["tasks"]["myTaskName"]["type"]]['short_code'] to get the correct short code or any other info.

Second point is that with this we also need to adjust GUI on a few places.
image
class TasksModel(TreeModel) in avalon/tools/models for example (maybe just there actually)

Changed both for config ("tasks":{TYPE: {"short_name":""}}) and assets
("tasks": {"TASK_NAME": {"type":config.tasks.TYPE}})
Modifications based on change
Modifications based on change
for tt in task_types:
tasks[tt["name"]] = {
"short_name": get_task_short_name(tt["name"])
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation line over-indented for hanging indent

@kalisp
Copy link
Member Author

kalisp commented Sep 25, 2020

Changed do dictionaries.
180_project
180_asset

Changed everywhere I could find that it should be changed.
Please test it in Nuke. (Maya and Clockify seems fine.)
Inventory app is not showing anything in Maya, but I don't think its a result of this change.

@kalisp kalisp requested a review from mkolar September 29, 2020 09:50
Copy link

@hound hound bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

./pype/tools/pyblish_pype/model.py:967:34: B008: Do not perform function call...
./pype/tools/pyblish_pype/model.py:967:34: B008: Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
./pype/tools/pyblish_pype/model.py:971:31: B008: Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
./pype/tools/pyblish_pype/model.py:996:41: B008: Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.

if "jpg" in self.formats:
save_options.append('jpg')
save_options["jpg"] = photoshop.com_objects.JPEGSaveOptions()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (81 > 79 characters)

if "png" in self.formats:
save_options.append('png')
save_options["png"] = photoshop.com_objects.PNGSaveOptions()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (80 > 79 characters)

len(data.get("comments", []))
)
len(data["comments"])
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closing bracket does not match indentation of opening bracket's line

@@ -40,13 +40,13 @@ def process(self, instance):
data["name"] = data["subset"] + "_" + data["asset"]

data["label"] = (
"{} - {} - tasks: {} - assetbuilds: {} - comments: {}".format(
"{} - {} - tasks:{} - assetbuilds:{} - comments:{}".format(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation line over-indented for hanging indent

@kalisp kalisp closed this Sep 29, 2020
@kalisp kalisp deleted the feature/180-Store_task_types branch September 29, 2020 10:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants