Skip to content

Instantly share code, notes, and snippets.

@BigRoy
Created July 23, 2024 23:14
Show Gist options
  • Save BigRoy/4792c0ebc311f5857841325c850293d8 to your computer and use it in GitHub Desktop.
Save BigRoy/4792c0ebc311f5857841325c850293d8 to your computer and use it in GitHub Desktop.
AYON - Set status for versions
"""WARNING! Set random status for all your versions in the project."""
import random
from ayon_core.pipeline import get_current_project_name
from ayon_api import get_project, get_versions
from ayon_api.operations import OperationsSession
project_name = get_current_project_name()
def get_project_status_names(project_entity):
statuses = project_entity["statuses"]
return [status["name"] for status in statuses]
project = get_project(project_name)
statuses = get_project_status_names(project)
session = OperationsSession()
for version in ayon_api.get_versions(project_name, fields={"id"}):
session.update_entity(
project_name,
"version",
version["id"],
{"status": random.choice(statuses)}
)
session.commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment