Error entering a workflow state that has a POST action

When things don't work as they should.
Post Reply
joekhoobyar
Posts: 9
Joined: Mon Feb 24, 2020 3:49 am

Error entering a workflow state that has a POST action

Post by joekhoobyar »

I am running mayan version *3.3.15*, on amd64 linux, in kubernetes.

My database is postgres, and my document store is minio.

The POST action is calling an external microservice, not Mayan itself.

Most of my documents work just fine on this step, but these particular ones (with 10 to 12 pages of OCR content) fail miserably.

The failures are below:

Code: Select all

[mayan-0] [2020-03-16 03:15:29,503: ERROR/ForkPoolWorker-5] Task mayan.apps.document_indexing.tasks.task_index_document[af6875f4-a575-4a16-9a0b-d931076f7505] raised unexpected: DoesNotExist('IndexInstanceNode matching query does not exist.') 
[mayan-0] Traceback (most recent call last): 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 178, in __get__ 
[mayan-0]     rel_obj = getattr(instance, self.cache_name) 
[mayan-0] AttributeError: 'IndexInstanceNode' object has no attribute '_parent_cache' 
[mayan-0]  
[mayan-0] During handling of the above exception, another exception occurred: 
[mayan-0]  
[mayan-0] Traceback (most recent call last): 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/celery/app/trace.py", line 385, in trace_task 
[mayan-0]     R = retval = fun(*args, **kwargs) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/celery/app/trace.py", line 648, in __protected_call__ 
[mayan-0]     return self.run(*args, **kwargs) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_indexing/tasks.py", line 45, in task_index_document 
[mayan-0]     Index.objects.index_document(document=document) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_indexing/managers.py", line 19, in index_document 
[mayan-0]     index.index_document(document=document) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_indexing/models.py", line 126, in index_document 
[mayan-0]     index_instance_node.delete_empty() 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_indexing/models.py", line 409, in delete_empty 
[mayan-0]     if self.parent.is_root_node(): 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 184, in __get__ 
[mayan-0]     rel_obj = self.get_object(instance) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 159, in get_object 
[mayan-0]     return qs.get(self.field.get_reverse_related_filter(instance)) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/query.py", line 380, in get 
[mayan-0]     self.model._meta.object_name 
[mayan-0] mayan.apps.document_indexing.models.DoesNotExist: IndexInstanceNode matching query does not exist. 
[mayan-0] [2020-03-16 03:15:35,031: ERROR/ForkPoolWorker-9] Task mayan.apps.document_indexing.tasks.task_index_document[428d43ab-a8d9-4d9c-a55f-48e933ffcca9] raised unexpected: DoesNotExist('IndexInstanceNode matching query does not exist.') 
[mayan-0] Traceback (most recent call last): 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 178, in __get__ 
[mayan-0]     rel_obj = getattr(instance, self.cache_name) 
[mayan-0] AttributeError: 'IndexInstanceNode' object has no attribute '_parent_cache' 
[mayan-0]  
[mayan-0] During handling of the above exception, another exception occurred: 
[mayan-0]  
[mayan-0] Traceback (most recent call last): 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/celery/app/trace.py", line 385, in trace_task 
[mayan-0]     R = retval = fun(*args, **kwargs) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/celery/app/trace.py", line 648, in __protected_call__ 
[mayan-0]     return self.run(*args, **kwargs) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_indexing/tasks.py", line 45, in task_index_document 
[mayan-0]     Index.objects.index_document(document=document) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_indexing/managers.py", line 19, in index_document 
[mayan-0]     index.index_document(document=document) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_indexing/models.py", line 126, in index_document 
[mayan-0]     index_instance_node.delete_empty() 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_indexing/models.py", line 409, in delete_empty 
[mayan-0]     if self.parent.is_root_node(): 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 184, in __get__ 
[mayan-0]     rel_obj = self.get_object(instance) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 159, in get_object 
[mayan-0]     return qs.get(self.field.get_reverse_related_filter(instance)) 
[mayan-0]   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/query.py", line 380, in get 
[mayan-0]     self.model._meta.object_name 
[mayan-0] mayan.apps.document_indexing.models.DoesNotExist: IndexInstanceNode matching query does not exist. 
[mayan-0] mayan.apps.navigation.classes <4111> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]""
The post body for the POST action is:

Code: Select all

{
  "id" : {{ document.id }},
  "type" : {{ document.document_type_id }},
  "text" : "{{ document.latest_version.ocr_content | join:" " | escapejs }}"
}
There are no error log entries for the POST action.

The POST action executes "on entry" into the state.

User avatar
rssfed23
Moderator
Moderator
Posts: 213
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Error entering a workflow state that has a POST action

Post by rssfed23 »

I think you should log a gitlab issue for this. I do wonder if it's in some way related to https://gitlab.com/mayan-edms/mayan-edms/-/issues/720
Please bear with us during the current global situation. The team all have families and local communities to look after as well as the community here. Responses may be delayed during this time, but rest assured we will get to your query eventually.

joekhoobyar
Posts: 9
Joined: Mon Feb 24, 2020 3:49 am

Re: Error entering a workflow state that has a POST action

Post by joekhoobyar »

I have managed to get rid of the 1st error by rewriting all of my indexes to always return a non-blank value.

The 2nd error still persists:

Code: Select all

[mayan-0] mayan.apps.navigation.classes <4111> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]""

joekhoobyar
Posts: 9
Joined: Mon Feb 24, 2020 3:49 am

Workflow always fails entering a state with a POST action.

Post by joekhoobyar »

Even after fixing my earlier issues with indexes, I still get the same error whenever a document enters a state with a POST action:

Code: Select all

[mayan-0] mayan.apps.navigation.classes <4111> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]""

joekhoobyar
Posts: 9
Joined: Mon Feb 24, 2020 3:49 am

Re: Workflow always fails entering a state with a POST action.

Post by joekhoobyar »

Here it is after uploading 12 documents:

Code: Select all

[mayan-0] mayan.apps.navigation.classes <1364> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]"" 
[mayan-0] mayan.apps.navigation.classes <1354> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]"" 
[mayan-0] mayan.apps.navigation.classes <1354> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]"" 
[mayan-0] mayan.apps.navigation.classes <1354> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]"" 
[mayan-0] mayan.apps.navigation.classes <1364> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]"" 
[mayan-0] mayan.apps.navigation.classes <1354> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]"" 
[mayan-0] [2020-03-16 23:50:38 +0000] [1354] [INFO] Autorestarting worker after current request. 
[mayan-0] [2020-03-16 23:50:38 +0000] [1354] [INFO] Worker exiting (pid: 1354) 
[mayan-0] [2020-03-16 23:50:39 +0000] [2478] [INFO] Booting worker with pid: 2478 
[mayan-0] mayan.apps.navigation.classes <2478> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]"" 
[mayan-0] [2020-03-16 23:51:40 +0000] [1364] [INFO] Autorestarting worker after current request. 
[mayan-0] [2020-03-16 23:51:40 +0000] [1364] [INFO] Worker exiting (pid: 1364) 
[mayan-0] [2020-03-16 23:51:40 +0000] [2716] [INFO] Booting worker with pid: 2716 
[mayan-0] mayan.apps.navigation.classes <2478> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]"" 
[mayan-0] mayan.apps.navigation.classes <2478> [ERROR] "resolve() line 192 Error resolving link "Create state" URL; Failed lookup for key [workflow] in "[{'True': True, 'False': False, 'None': None}, {'object': <WorkflowRuntimeProxy: Incoming Documents>}, {}, {'resolved_object': <WorkflowRuntimeProxy: Incoming Documents>}]"" 

User avatar
rssfed23
Moderator
Moderator
Posts: 213
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Workflow always fails entering a state with a POST action.

Post by rssfed23 »

As per the other thread, please log a gitlab issue for the developers to investigate referencing these forum threads. As it could potentially be a bug, it needs to be logged there as it will likely be seen much quicker than on the forum. I would normally do this myself, but stuck on a mobile device.
Please bear with us during the current global situation. The team all have families and local communities to look after as well as the community here. Responses may be delayed during this time, but rest assured we will get to your query eventually.

joekhoobyar
Posts: 9
Joined: Mon Feb 24, 2020 3:49 am

Re: Error entering a workflow state that has a POST action

Post by joekhoobyar »

Here is the github issue link:

https://gitlab.com/mayan-edms/mayan-edms/-/issues/793

I hope that we can get this fixed - I have thousands of documents to upload, and i really want my "auto classifier" microservice to help me in avoiding manual entry.

gtrot
Posts: 13
Joined: Tue Oct 01, 2019 9:03 pm

Re: Error entering a workflow state that has a POST action

Post by gtrot »

Hi,

I had similar errors by the past, dumping the docker container then start with a new image, restart the redis container, plus deleting the cache (workflows and documents) resolved some. You could give it a try.

Regards,
G

joekhoobyar
Posts: 9
Joined: Mon Feb 24, 2020 3:49 am

Re: Error entering a workflow state that has a POST action

Post by joekhoobyar »

How do I delete the cache? Are you talking about the files on disk, or some database records?

What's the recommended way to do that?

gtrot
Posts: 13
Joined: Tue Oct 01, 2019 9:03 pm

Re: Error entering a workflow state that has a POST action

Post by gtrot »

In Mayan directly, using the maintenance tools : System--»»Tools--»»File Caching menu. My installation is in french, the menu tags could variate. Hope it help!
G

Post Reply