Sync branch magefile with main #104308
@ -286,16 +286,16 @@ class Transferrer(submodules.transfer.FileTransferer): # type: ignore
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
self.log.debug(" %s: %s", file_spec.status, file_spec.path)
|
self.log.debug(" %s: %s", file_spec.status, file_spec.path)
|
||||||
match file_spec.status.value:
|
status = file_spec.status.value
|
||||||
case "unknown":
|
if status == "unknown":
|
||||||
to_upload.appendleft(file_spec)
|
to_upload.appendleft(file_spec)
|
||||||
case "uploading":
|
elif status == "uploading":
|
||||||
to_upload.append(file_spec)
|
to_upload.append(file_spec)
|
||||||
case _:
|
else:
|
||||||
msg = "Unknown status in response from Shaman: %r" % file_spec
|
msg = "Unknown status in response from Shaman: %r" % file_spec
|
||||||
self.log.error(msg)
|
self.log.error(msg)
|
||||||
self.error_set(msg)
|
self.error_set(msg)
|
||||||
return None
|
return None
|
||||||
return to_upload
|
return to_upload
|
||||||
|
|
||||||
def _upload_files(
|
def _upload_files(
|
||||||
@ -375,25 +375,26 @@ class Transferrer(submodules.transfer.FileTransferer): # type: ignore
|
|||||||
x_shaman_original_filename=file_spec.path,
|
x_shaman_original_filename=file_spec.path,
|
||||||
)
|
)
|
||||||
except ApiException as ex:
|
except ApiException as ex:
|
||||||
match ex.status:
|
if ex.status == 425:
|
||||||
case 425: # Too Early, i.e. defer uploading this file.
|
# Too Early, i.e. defer uploading this file.
|
||||||
self.log.info(
|
self.log.info(
|
||||||
" %s: someone else is uploading this file, deferring",
|
" %s: someone else is uploading this file, deferring",
|
||||||
file_spec.path,
|
file_spec.path,
|
||||||
)
|
)
|
||||||
defer(file_spec)
|
defer(file_spec)
|
||||||
continue
|
continue
|
||||||
case 417: # Expectation Failed; mismatch of checksum or file size.
|
elif ex.status == 417:
|
||||||
msg = "Error from Shaman uploading %s, code %d: %s" % (
|
# Expectation Failed; mismatch of checksum or file size.
|
||||||
file_spec.path,
|
msg = "Error from Shaman uploading %s, code %d: %s" % (
|
||||||
ex.status,
|
file_spec.path,
|
||||||
ex.body,
|
ex.status,
|
||||||
)
|
ex.body,
|
||||||
case _: # Unknown error
|
)
|
||||||
msg = "API exception\nHeaders: %s\nBody: %s\n" % (
|
else: # Unknown error
|
||||||
ex.headers,
|
msg = "API exception\nHeaders: %s\nBody: %s\n" % (
|
||||||
ex.body,
|
ex.headers,
|
||||||
)
|
ex.body,
|
||||||
|
)
|
||||||
|
|
||||||
self.log.error(msg)
|
self.log.error(msg)
|
||||||
self.error_set(msg)
|
self.error_set(msg)
|
||||||
@ -453,19 +454,15 @@ class Transferrer(submodules.transfer.FileTransferer): # type: ignore
|
|||||||
checkoutRequest
|
checkoutRequest
|
||||||
)
|
)
|
||||||
except ApiException as ex:
|
except ApiException as ex:
|
||||||
match ex.status:
|
if ex.status == 424: # Files were missing
|
||||||
case 424: # Files were missing
|
msg = "We did not upload some files, checkout aborted"
|
||||||
msg = "We did not upload some files, checkout aborted"
|
elif ex.status == 409: # Checkout already exists
|
||||||
case 409: # Checkout already exists
|
msg = "There is already an existing checkout at %s" % self.checkout_path
|
||||||
msg = (
|
else: # Unknown error
|
||||||
"There is already an existing checkout at %s"
|
msg = "API exception\nHeaders: %s\nBody: %s\n" % (
|
||||||
% self.checkout_path
|
ex.headers,
|
||||||
)
|
ex.body,
|
||||||
case _: # Unknown error
|
)
|
||||||
msg = "API exception\nHeaders: %s\nBody: %s\n" % (
|
|
||||||
ex.headers,
|
|
||||||
ex.body,
|
|
||||||
)
|
|
||||||
self.log.error(msg)
|
self.log.error(msg)
|
||||||
self.error_set(msg)
|
self.error_set(msg)
|
||||||
return None
|
return None
|
||||||
|
@ -5,7 +5,7 @@ import dataclasses
|
|||||||
import json
|
import json
|
||||||
import platform
|
import platform
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING, Optional
|
from typing import TYPE_CHECKING, Optional, Union
|
||||||
|
|
||||||
from urllib3.exceptions import HTTPError, MaxRetryError
|
from urllib3.exceptions import HTTPError, MaxRetryError
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ def _to_json(info: ManagerInfo) -> str:
|
|||||||
return json.dumps(info, indent=" ", cls=Encoder)
|
return json.dumps(info, indent=" ", cls=Encoder)
|
||||||
|
|
||||||
|
|
||||||
def _from_json(contents: str | bytes) -> ManagerInfo:
|
def _from_json(contents: Union[str, bytes]) -> ManagerInfo:
|
||||||
# Do a late import, so that the API is only imported when actually used.
|
# Do a late import, so that the API is only imported when actually used.
|
||||||
from flamenco.manager.configuration import Configuration
|
from flamenco.manager.configuration import Configuration
|
||||||
from flamenco.manager.model_utils import validate_and_convert_types
|
from flamenco.manager.model_utils import validate_and_convert_types
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# <pep8 compliant>
|
# <pep8 compliant>
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Callable, TypeAlias
|
from typing import Callable
|
||||||
import dataclasses
|
import dataclasses
|
||||||
|
|
||||||
from .bat.submodules import bpathlib
|
from .bat.submodules import bpathlib
|
||||||
@ -64,7 +64,7 @@ def _search_path_marker(blendfile: Path, marker_path: str) -> Path:
|
|||||||
return blendfile_dir
|
return blendfile_dir
|
||||||
|
|
||||||
|
|
||||||
Finder: TypeAlias = Callable[[Path], Path]
|
Finder = Callable[[Path], Path]
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass
|
@dataclasses.dataclass
|
||||||
|
Loading…
Reference in New Issue
Block a user