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

Error while adding +1 to casted assets #869

Open
aka-anoop opened this issue Oct 11, 2024 · 3 comments
Open

Error while adding +1 to casted assets #869

aka-anoop opened this issue Oct 11, 2024 · 3 comments
Assignees
Labels

Comments

@aka-anoop
Copy link

Context

Studio name: BOTVFX
Kitsu version: 0.19.65
Production type: Feature Film

Describe the bug

Error while trying to add +1 to cast assets

"Traceback (most recent call last):\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\
    self.dialect.do_execute(\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/engine/default.py\", line 941, in do_execute\
    cursor.execute(statement, parameters)\
  File \"/opt/zou/env/lib/python3.10/site-packages/psycopg/cursor.py\", line 97, in execute\
    raise ex.with_traceback(None)\
psycopg.errors.InvalidTextRepresentation: invalid input syntax for type integer: \"134bbc442-aabd-41dd-b5bd-fd6ca69aaefb\"\
CONTEXT:  unnamed portal parameter $3 = '...'\
\
The above exception was the direct cause of the following exception:\
\
Traceback (most recent call last):\
  File \"/opt/zou/env/lib/python3.10/site-packages/flask/app.py\", line 880, in full_dispatch_request\
    rv = self.dispatch_request()\
  File \"/opt/zou/env/lib/python3.10/site-packages/flask/app.py\", line 865, in dispatch_request\
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]\
  File \"/opt/zou/env/lib/python3.10/site-packages/flask_restful/__init__.py\", line 489, in wrapper\
    resp = resource(*args, **kwargs)\
  File \"/opt/zou/env/lib/python3.10/site-packages/flask/views.py\", line 110, in view\
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)  # type: ignore[no-any-return]\
  File \"/opt/zou/env/lib/python3.10/site-packages/flask_restful/__init__.py\", line 604, in dispatch_request\
    resp = meth(*args, **kwargs)\
  File \"/opt/zou/env/lib/python3.10/site-packages/flask_jwt_extended/view_decorators.py\", line 170, in decorator\
    return current_app.ensure_sync(fn)(*args, **kwargs)\
  File \"/opt/zou/env/lib/python3.10/site-packages/zou/app/blueprints/breakdown/resources.py\", line 71, in put\
    return breakdown_service.update_casting(entity_id, casting)\
  File \"/opt/zou/env/lib/python3.10/site-packages/zou/app/services/breakdown_service.py\", line 283, in update_casting\
    create_casting_link(\
  File \"/opt/zou/env/lib/python3.10/site-packages/zou/app/services/breakdown_service.py\", line 334, in create_casting_link\
    link = EntityLink.create(\
  File \"/opt/zou/env/lib/python3.10/site-packages/zou/app/models/base.py\", line 89, in create\
    db.session.commit()\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/scoping.py\", line 597, in commit\
    return self._proxied.commit()\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/session.py\", line 2028, in commit\
    trans.commit(_to_root=True)\
  File \"<string>\", line 2, in commit\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py\", line 139, in _go\
    ret_value = fn(self, *arg, **kw)\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/session.py\", line 1313, in commit\
    self._prepare_impl()\
  File \"<string>\", line 2, in _prepare_impl\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py\", line 139, in _go\
    ret_value = fn(self, *arg, **kw)\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/session.py\", line 1288, in _prepare_impl\
    self.session.flush()\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/session.py\", line 4352, in flush\
    self._flush(objects)\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/session.py\", line 4487, in _flush\
    with util.safe_reraise():\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py\", line 146, in __exit__\
    raise exc_value.with_traceback(exc_tb)\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/session.py\", line 4448, in _flush\
    flush_context.execute()\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py\", line 466, in execute\
    rec.execute(self)\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py\", line 642, in execute\
    util.preloaded.orm_persistence.save_obj(\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py\", line 93, in save_obj\
    _emit_insert_statements(\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py\", line 1233, in _emit_insert_statements\
    result = connection.execute(\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py\", line 1418, in execute\
    return meth(\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/sql/elements.py\", line 515, in _execute_on_connection\
    return connection._execute_clauseelement(\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py\", line 1640, in _execute_clauseelement\
    ret = self._execute_context(\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\
    return self._exec_single_context(\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\
    self._handle_dbapi_exception(\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py\", line 2355, in _handle_dbapi_exception\
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\
    self.dialect.do_execute(\
  File \"/opt/zou/env/lib/python3.10/site-packages/sqlalchemy/engine/default.py\", line 941, in do_execute\
    cursor.execute(statement, parameters)\
  File \"/opt/zou/env/lib/python3.10/site-packages/psycopg/cursor.py\", line 97, in execute\
    raise ex.with_traceback(None)\
sqlalchemy.exc.DataError: (psycopg.errors.InvalidTextRepresentation) invalid input syntax for type integer: \"134bbc442-aabd-41dd-b5bd-fd6ca69aaefb\"\
CONTEXT:  unnamed portal parameter $3 = '...'\
[SQL: INSERT INTO entity_link (entity_in_id, entity_out_id, nb_occurences, label, id, created_at, updated_at) VALUES (%(entity_in_id)s::UUID, %(entity_out_id)s::UUID, %(nb_occurences)s::INTEGER, %(label)s::VARCHAR, %(id)s::UUID, %(created_at)s::TIMESTAMP WITHOUT TIME ZONE, %(updated_at)s::TIMESTAMP WITHOUT TIME ZONE)]\
[parameters: {'entity_in_id': '34bbc442-aabd-41dd-b5bd-fd6ca69aaefb', 'entity_out_id': '6ff6107d-6d55-4167-b47e-7a3679e6408b', 'nb_occurences': '134bbc442-aabd-41dd-b5bd-fd6ca69aaefb', 'label': 'animate', 'id': '978e243e-767d-4d40-9c0d-bc7b4159bb37', 'created_at': datetime.datetime(2024, 10, 11, 14, 2, 8, 26775), 'updated_at': datetime.datetime(2024, 10, 11, 14, 2, 8, 26782)}]\
(Background on this error at: https://sqlalche.me/e/20/9h9h)"
}

Screenshots

kitsu-casting-error.mov

Desktop (please complete the following information):

  • OS: Ayon docker MacOS
  • Browser Firefox
  • Version 131.0.2
@NicoPennec
Copy link
Member

NicoPennec commented Oct 11, 2024

Hi @aka-anoop

Can you give us your version of Kitsu API (Zou) from https://<your-instance>/api/status ?

It looks like your database is not up-to-date!

Try to follow the "update" topic from the documentation, especially the "Update database schema" section:
https://zou.cg-wire.com/#update

@NicoPennec NicoPennec transferred this issue from cgwire/kitsu Oct 11, 2024
@PeteDraper
Copy link

PeteDraper commented Oct 12, 2024

If the db hasn’t been updated properly you’ll definitely have casting issues. To fully update you’ll not only need to update kitsu but zou and the db:

this is my normal process for updating kitsu etc:

cd /opt/zou
sudo /opt/zou/zouenv/bin/python -m pip install --upgrade zou
sudo -u zou DB_PASSWORD=YOURDBPASSWORD /opt/zou/zouenv/bin/zou upgrade-db
sudo chown -R zou:www-data /opt/zou/backups
sudo chown -R zou:www-data /opt/zou/logs
sudo chown -R zou:www-data /opt/zou/tmp
sudo chown -R zou:www-data /opt/zou/zouenv
sudo systemctl restart zou
sudo systemctl restart zou-events
sudo systemctl restart zou-jobs
cd /opt/kitsu
sudo git reset --hard
sudo git pull --rebase origin build
sudo systemctl restart nginx

Try this and see if it works

@aka-anoop
Copy link
Author

Thanks for the suggestions @NicoPennec and @PeteDraper

⚠️ Missed mentioning that I am running this off docker for testing.

Here is what I tried based on both of you suggestions:

Connected to the docker instance and ran the following
source /opt/zou/env/bin/activate(env) root@cgwire:/opt/zou# python -m pip install --upgrade zou

Requirement already satisfied: zou in ./env/lib/python3.10/site-packages (0.19.56)
Collecting zou
Successfully installed flask-socketio-5.4.1 gevent-24.10.1 numpy-2.1.2 redis-5.1.1 zou-0.19.57

(env) root@cgwire:/opt/zou# DB_PASSWORD=mysecretpassword /opt/zou/env/bin/zou upgrade-db

INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade 59a7445a966c -> 8e67c183bed7, add prefeence fields

Updated kitsu using instructions mentioned in https://zou.cg-wire.com/

curl -L -o /tmp/kitsu.tgz $(curl -v <https://api.github.com/repos/cgwire/kitsu/releases/latest> | grep 'browser_download_url.*kitsu-.*.tgz' | cut -d : -f 2,3 | tr -d \\")
tar xvzf /tmp/kitsu.tgz -C /opt/zou/kitsu/

Restarted the docker instance and tried again. Same error!
Tested Zou version using api/status endpoint

{
  "name": "Zou",
  "version": "0.19.57",
  "database-up": true,
  "key-value-store-up": true,
  "event-stream-up": true,
  "job-queue-up": false,
  "indexer-up": false
}

The request payload is as follows

[
	{
		"asset_id": "28091433-daff-4fc3-9d97-909e0deb87a0",
		"label": "animate",
		"nb_occurences": "1ffbd7da7-02d6-47c6-9558-569da0a76711"
	}
]

⚠️ It looks like nb_occurences is being concatenated with entity_id 1, ffbd7da7-02d6-47c6-9558-569da0a76711

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