Skip to content
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

gazu.task.get_task_by_name returns nothing #308

Closed
Sharkitty opened this issue Jan 10, 2024 · 4 comments
Closed

gazu.task.get_task_by_name returns nothing #308

Sharkitty opened this issue Jan 10, 2024 · 4 comments
Assignees
Labels

Comments

@Sharkitty
Copy link

Context

Studio name: Normaal Animation
Gazu version: 0.9.14 (Also happens in 0.8.34)
Zou installation type: Self-hosted (version 0.17.63)

Describe the bug
When trying to access gazu task using gazu.task.get_task_by_name, nothing in returns even though all arguments are valid, the task exists and can be accessed through other means. We encountered this on assets, in Concept task (I'm not sure if that is relevant to the issue).

Expected behavior
gazu.task.get_task_by_name should return the requested task.

Code
This is an example code that reproduces the issue I'm dealing with. The original code where the issue has been discovered contains unrelated OpenPype stuff.

from pprint import pprint

import gazu

# Replace by appropriate login information
gazu.client.set_host(host)
gazu.log_in(login, password)

# Replace by your project name
zou_project = gazu.project.get_project_by_name("WoollyWoolly")
task_type = gazu.task.get_task_type_by_name("Concept")

all_entities_for_project = gazu.asset.all_assets_for_project(zou_project)
entities = {entity["name"]: entity for entity in all_entities_for_project}

# Replace by the name of your asset
entity = entities.get("Bonnet01_Fraise_MD")

# This is where my issue happens
task = gazu.task.get_task_by_name(entity, task_type)

# Entity is printed
print("entity")
pprint(entity)

# Task is printed
print("task_type")
pprint(task_type)

# task is None, so nothing is printed
print("task")
pprint(task)

# Work around I used to get task without the malfunctionning method
for task in gazu.task.all_tasks_for_asset(entity):
    if task["task_type_name"] == "Concept":
      # Task is printed now
      pprint(task)

gazu.log_out()

Additional context
The original code where the issue has been discovered has been in use for quite a while without change, and we never encountered this before.

@frankrousseau
Copy link
Contributor

Hello @Sharkitty, sorry for that. Are you sure that you have a task for this entity?

@EvanBldy is investigating.

@Sharkitty
Copy link
Author

Hello @Sharkitty, sorry for that. Are you sure that you have a task for this entity?

@EvanBldy is investigating.

Hello! Yes I am. I can see it on kitsu, and I've also been able to get it from gazu using a work around (which is included in my report, as the last block of code before log out). In fact I had a bunch of assets for which I needed to run this code, it failed for all of them with get_task_by_name, and worked with my work around. This is the only anomaly too, everything else works just fine, I verified that the entity and task_type data exist and are correct, I also verified that the task name is main (The default value for this method). This bug is kinda strange ^^

@EvanBldy
Copy link
Member

Hi @Sharkitty,
I have done a PR and a new version of Gazu (#309) to fix your problem.
The main problem was that two task type with same name and different "for_entity" are coexisting.
If it's okay for you can you close this issue ?
Have a nice day

@Sharkitty
Copy link
Author

Hi @Sharkitty, I have done a PR and a new version of Gazu (#309) to fix your problem. The main problem was that two task type with same name and different "for_entity" are coexisting. If it's okay for you can you close this issue ? Have a nice day

Sorry for the delay! I've just tested and it works well now. Thanks for the help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants