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

Store task types in the database #572

Merged
merged 12 commits into from
Oct 2, 2020

Conversation

kalisp
Copy link
Member

@kalisp kalisp commented Sep 29, 2020

Re-creation of broken PR #516
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.

Changed do dictionaries.
180_project

Asset
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.

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

Resetting queries: (EDIT)
db.getCollection('YOUR_COLLECTION_NAME').updateMany({type:"project"}, {$unset: {"config.tasks":""}})
db.getCollection('YOUR_COLLECTION_NAME').updateMany({type:"asset"}, {$unset: {"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.
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
Revert unwanted merge
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

@mkolar
Copy link
Member

mkolar commented Oct 1, 2020

the resetting query needs to be

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

to completely wipe the tasks, otherwise the sync fails

@mkolar
Copy link
Member

mkolar commented Oct 1, 2020

the last thing that seems to be blocking this is broken workfiles app after the change

@mkolar mkolar self-requested a review October 1, 2020 15:45
@mkolar mkolar added this to the 2.13 milestone Oct 1, 2020
@kalisp kalisp self-assigned this Oct 1, 2020
@mkolar mkolar added the backend label Oct 1, 2020
@kalisp
Copy link
Member Author

kalisp commented Oct 2, 2020

I don't think that Workfile Save as is result of this change, see ynput/avalon-core@c5cc6e1 (error message sent: AttributeError: 'list' object has no attribute 'clear')

I found some issues when creating completely new DB though, fixed them.

@mkolar
Copy link
Member

mkolar commented Oct 2, 2020

you're right, it was because this branch was not up to date with develop.

@mkolar mkolar added the type: enhancement Enhancements to existing functionality label Oct 2, 2020
@mkolar mkolar changed the base branch from feature/180-Store_task_types to 2.x/develop October 2, 2020 10:45
@mkolar mkolar merged commit 9eac97e into ynput:2.x/develop Oct 2, 2020
@mkolar mkolar changed the title Feature/180 store task types Store task types in the database Oct 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Enhancements to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants