mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
added more logs
This commit is contained in:
parent
faff50ce33
commit
dde471332f
2 changed files with 24 additions and 6 deletions
|
|
@ -6,7 +6,7 @@ from ayon_api import TransferProgress
|
||||||
from ayon_api.server_api import RequestTypes
|
from ayon_api.server_api import RequestTypes
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
|
|
||||||
from ayon_core.lib import get_media_mime_type
|
from ayon_core.lib import get_media_mime_type, format_file_size
|
||||||
from ayon_core.pipeline.publish import (
|
from ayon_core.pipeline.publish import (
|
||||||
PublishXmlValidationError,
|
PublishXmlValidationError,
|
||||||
get_publish_repre_path,
|
get_publish_repre_path,
|
||||||
|
|
@ -120,18 +120,26 @@ class IntegrateAYONReview(pyblish.api.InstancePlugin):
|
||||||
if hasattr(TransferProgress, "get_attempt"):
|
if hasattr(TransferProgress, "get_attempt"):
|
||||||
max_retries = 1
|
max_retries = 1
|
||||||
|
|
||||||
|
size = os.path.getsize(repre_path)
|
||||||
|
self.log.info(
|
||||||
|
f"Uploading '{repre_path}' (size: {format_file_size(size)})"
|
||||||
|
)
|
||||||
|
|
||||||
# How long to sleep before next attempt
|
# How long to sleep before next attempt
|
||||||
wait_time = 1
|
wait_time = 1
|
||||||
last_error = None
|
last_error = None
|
||||||
for attempt in range(max_retries):
|
for attempt in range(max_retries):
|
||||||
attempt += 1
|
attempt += 1
|
||||||
|
start = time.time()
|
||||||
try:
|
try:
|
||||||
return ayon_con.upload_file(
|
output = ayon_con.upload_file(
|
||||||
endpoint,
|
endpoint,
|
||||||
repre_path,
|
repre_path,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
request_type=RequestTypes.post,
|
request_type=RequestTypes.post,
|
||||||
)
|
)
|
||||||
|
self.log.info(f"Uploade in {time.time() - start}s.")
|
||||||
|
return output
|
||||||
|
|
||||||
except (
|
except (
|
||||||
requests.exceptions.Timeout,
|
requests.exceptions.Timeout,
|
||||||
|
|
@ -143,7 +151,8 @@ class IntegrateAYONReview(pyblish.api.InstancePlugin):
|
||||||
break
|
break
|
||||||
|
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
f"Review upload failed ({attempt}/{max_retries})."
|
f"Review upload failed ({attempt}/{max_retries})"
|
||||||
|
f" after {time.time() - start}s."
|
||||||
f" Retrying in {wait_time}s...",
|
f" Retrying in {wait_time}s...",
|
||||||
exc_info=True,
|
exc_info=True,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ from ayon_api.operations import OperationsSession
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from ayon_core.lib import get_media_mime_type
|
from ayon_core.lib import get_media_mime_type, format_file_size
|
||||||
from ayon_core.pipeline.publish import PublishXmlValidationError
|
from ayon_core.pipeline.publish import PublishXmlValidationError
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -266,18 +266,26 @@ class IntegrateThumbnailsAYON(pyblish.api.ContextPlugin):
|
||||||
if hasattr(TransferProgress, "get_attempt"):
|
if hasattr(TransferProgress, "get_attempt"):
|
||||||
max_retries = 1
|
max_retries = 1
|
||||||
|
|
||||||
|
size = os.path.getsize(repre_path)
|
||||||
|
self.log.info(
|
||||||
|
f"Uploading '{repre_path}' (size: {format_file_size(size)})"
|
||||||
|
)
|
||||||
|
|
||||||
# How long to sleep before next attempt
|
# How long to sleep before next attempt
|
||||||
wait_time = 1
|
wait_time = 1
|
||||||
last_error = None
|
last_error = None
|
||||||
for attempt in range(max_retries):
|
for attempt in range(max_retries):
|
||||||
attempt += 1
|
attempt += 1
|
||||||
|
start = time.time()
|
||||||
try:
|
try:
|
||||||
return ayon_con.upload_file(
|
output = ayon_con.upload_file(
|
||||||
endpoint,
|
endpoint,
|
||||||
repre_path,
|
repre_path,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
request_type=RequestTypes.post,
|
request_type=RequestTypes.post,
|
||||||
)
|
)
|
||||||
|
self.log.info(f"Uploade in {time.time() - start}s.")
|
||||||
|
return output
|
||||||
|
|
||||||
except (
|
except (
|
||||||
requests.exceptions.Timeout,
|
requests.exceptions.Timeout,
|
||||||
|
|
@ -289,7 +297,8 @@ class IntegrateThumbnailsAYON(pyblish.api.ContextPlugin):
|
||||||
break
|
break
|
||||||
|
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
f"Review upload failed ({attempt}/{max_retries})."
|
f"Review upload failed ({attempt}/{max_retries})"
|
||||||
|
f" after {time.time() - start}s."
|
||||||
f" Retrying in {wait_time}s...",
|
f" Retrying in {wait_time}s...",
|
||||||
exc_info=True,
|
exc_info=True,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue