mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
added job of synchronization where can be uploaded traceback
This commit is contained in:
parent
2bd9ef0b53
commit
71a2dd8a67
2 changed files with 68 additions and 0 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import time
|
||||
import sys
|
||||
import json
|
||||
import traceback
|
||||
|
||||
from openpype_modules.ftrack.lib import ServerAction
|
||||
|
|
@ -52,6 +54,20 @@ class SyncToAvalonServer(ServerAction):
|
|||
return False
|
||||
|
||||
def launch(self, session, in_entities, event):
|
||||
self.log.debug("{}: Creating job".format(self.label))
|
||||
|
||||
user_entity = session.query(
|
||||
"User where id is {}".format(event["source"]["user"]["id"])
|
||||
).one()
|
||||
job_entity = session.create("Job", {
|
||||
"user": user_entity,
|
||||
"status": "running",
|
||||
"data": json.dumps({
|
||||
"description": "Sync to avalon is running..."
|
||||
})
|
||||
})
|
||||
session.commit()
|
||||
|
||||
project_entity = self.get_project_from_entity(in_entities[0])
|
||||
project_name = project_entity["full_name"]
|
||||
|
||||
|
|
@ -62,6 +78,12 @@ class SyncToAvalonServer(ServerAction):
|
|||
self.log.error(
|
||||
"Synchronization failed due to code error", exc_info=True
|
||||
)
|
||||
|
||||
description = "Sync to avalon Crashed (Download traceback)"
|
||||
self.add_traceback_to_job(
|
||||
job_entity, session, sys.exc_info(), description
|
||||
)
|
||||
|
||||
msg = "An error has happened during synchronization"
|
||||
title = "Synchronization report ({}):".format(project_name)
|
||||
items = []
|
||||
|
|
@ -69,6 +91,12 @@ class SyncToAvalonServer(ServerAction):
|
|||
"type": "label",
|
||||
"value": "# {}".format(msg)
|
||||
})
|
||||
items.append({
|
||||
"type": "label",
|
||||
"value": (
|
||||
"<p>Download report from job for more information.</p>"
|
||||
)
|
||||
})
|
||||
|
||||
report = {}
|
||||
try:
|
||||
|
|
@ -85,6 +113,12 @@ class SyncToAvalonServer(ServerAction):
|
|||
|
||||
return {"success": True, "message": msg}
|
||||
|
||||
job_entity["status"] = "done"
|
||||
job_entity["data"] = json.dumps({
|
||||
"description": "Sync to avalon finished."
|
||||
})
|
||||
session.commit()
|
||||
|
||||
return result
|
||||
|
||||
def synchronization(self, event, project_name):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import time
|
||||
import sys
|
||||
import json
|
||||
import traceback
|
||||
|
||||
from openpype_modules.ftrack.lib import BaseAction, statics_icon
|
||||
|
|
@ -63,6 +65,20 @@ class SyncToAvalonLocal(BaseAction):
|
|||
return is_valid
|
||||
|
||||
def launch(self, session, in_entities, event):
|
||||
self.log.debug("{}: Creating job".format(self.label))
|
||||
|
||||
user_entity = session.query(
|
||||
"User where id is {}".format(event["source"]["user"]["id"])
|
||||
).one()
|
||||
job_entity = session.create("Job", {
|
||||
"user": user_entity,
|
||||
"status": "running",
|
||||
"data": json.dumps({
|
||||
"description": "Sync to avalon is running..."
|
||||
})
|
||||
})
|
||||
session.commit()
|
||||
|
||||
project_entity = self.get_project_from_entity(in_entities[0])
|
||||
project_name = project_entity["full_name"]
|
||||
|
||||
|
|
@ -73,6 +89,12 @@ class SyncToAvalonLocal(BaseAction):
|
|||
self.log.error(
|
||||
"Synchronization failed due to code error", exc_info=True
|
||||
)
|
||||
|
||||
description = "Sync to avalon Crashed (Download traceback)"
|
||||
self.add_traceback_to_job(
|
||||
job_entity, session, sys.exc_info(), description
|
||||
)
|
||||
|
||||
msg = "An error has happened during synchronization"
|
||||
title = "Synchronization report ({}):".format(project_name)
|
||||
items = []
|
||||
|
|
@ -80,6 +102,12 @@ class SyncToAvalonLocal(BaseAction):
|
|||
"type": "label",
|
||||
"value": "# {}".format(msg)
|
||||
})
|
||||
items.append({
|
||||
"type": "label",
|
||||
"value": (
|
||||
"<p>Download report from job for more information.</p>"
|
||||
)
|
||||
})
|
||||
|
||||
report = {}
|
||||
try:
|
||||
|
|
@ -96,6 +124,12 @@ class SyncToAvalonLocal(BaseAction):
|
|||
|
||||
return {"success": True, "message": msg}
|
||||
|
||||
job_entity["status"] = "done"
|
||||
job_entity["data"] = json.dumps({
|
||||
"description": "Sync to avalon finished."
|
||||
})
|
||||
session.commit()
|
||||
|
||||
return result
|
||||
|
||||
def synchronization(self, event, project_name):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue