Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions scaleway-async/scaleway_async/jobs/v1alpha2/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
resolve_one_of,
)
from .types import (
JobRunReason,
JobRunState,
SecretEnvVar,
SecretFile,
Secret,
Expand Down Expand Up @@ -194,19 +196,19 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition:
if field is not None:
args["cpu_limit"] = field
else:
args["cpu_limit"] = None
args["cpu_limit"] = 0

field = data.get("memory_limit", None)
if field is not None:
args["memory_limit"] = field
else:
args["memory_limit"] = None
args["memory_limit"] = 0

field = data.get("local_storage_capacity", None)
if field is not None:
args["local_storage_capacity"] = field
else:
args["local_storage_capacity"] = None
args["local_storage_capacity"] = 0

field = data.get("image_uri", None)
if field is not None:
Expand All @@ -218,7 +220,7 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition:
if field is not None:
args["environment_variables"] = field
else:
args["environment_variables"] = None
args["environment_variables"] = {}

Comment on lines 199 to 224
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably be left unchanged?

field = data.get("created_at", None)
if field is not None:
Expand Down Expand Up @@ -254,13 +256,13 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition:
if field is not None:
args["startup_command"] = field
else:
args["startup_command"] = None
args["startup_command"] = []

field = data.get("args", None)
if field is not None:
args["args"] = field
else:
args["args"] = None
args["args"] = []

field = data.get("region", None)
if field is not None:
Expand Down Expand Up @@ -307,13 +309,13 @@ def unmarshal_JobRun(data: Any) -> JobRun:
if field is not None:
args["state"] = field
else:
args["state"] = None
args["state"] = JobRunState.UNKNOWN_STATE

field = data.get("cpu_limit", None)
if field is not None:
args["cpu_limit"] = field
else:
args["cpu_limit"] = None
args["cpu_limit"] = 0

field = data.get("created_at", None)
if field is not None:
Expand All @@ -337,31 +339,31 @@ def unmarshal_JobRun(data: Any) -> JobRun:
if field is not None:
args["memory_limit"] = field
else:
args["memory_limit"] = None
args["memory_limit"] = 0

field = data.get("local_storage_capacity", None)
if field is not None:
args["local_storage_capacity"] = field
else:
args["local_storage_capacity"] = None
args["local_storage_capacity"] = 0

field = data.get("environment_variables", None)
if field is not None:
args["environment_variables"] = field
else:
args["environment_variables"] = None
args["environment_variables"] = {}

field = data.get("startup_command", None)
if field is not None:
args["startup_command"] = field
else:
args["startup_command"] = None
args["startup_command"] = []

field = data.get("args", None)
if field is not None:
args["args"] = field
else:
args["args"] = None
args["args"] = []

field = data.get("region", None)
if field is not None:
Expand All @@ -387,13 +389,13 @@ def unmarshal_JobRun(data: Any) -> JobRun:
if field is not None:
args["reason"] = field
else:
args["reason"] = None
args["reason"] = JobRunReason.UNKNOWN_REASON

field = data.get("exit_code", None)
if field is not None:
args["exit_code"] = field
else:
args["exit_code"] = None
args["exit_code"] = 0

field = data.get("error_message", None)
if field is not None:
Expand All @@ -411,7 +413,7 @@ def unmarshal_JobRun(data: Any) -> JobRun:
if field is not None:
args["attempts"] = field
else:
args["attempts"] = None
args["attempts"] = 0

return JobRun(**args)

Expand Down
6 changes: 3 additions & 3 deletions scaleway-async/scaleway_async/jobs/v1alpha2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,12 @@ class JobRun:
Duration of the job run.
"""

reason: Optional[JobRunReason] = None
reason: Optional[JobRunReason] = JobRunReason.UNKNOWN_REASON
"""
Reason for failure if the job failed.
"""

exit_code: Optional[int] = None
exit_code: Optional[int] = 0
"""
Exit code of the job.
"""
Expand All @@ -389,7 +389,7 @@ class JobRun:
Deprecated, please use startup_command instead.
"""

attempts: Optional[int] = None
attempts: Optional[int] = 0
"""
Number of retry attempts.
"""
Expand Down
34 changes: 18 additions & 16 deletions scaleway/scaleway/jobs/v1alpha2/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
resolve_one_of,
)
from .types import (
JobRunReason,
JobRunState,
SecretEnvVar,
SecretFile,
Secret,
Expand Down Expand Up @@ -194,19 +196,19 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition:
if field is not None:
args["cpu_limit"] = field
else:
args["cpu_limit"] = None
args["cpu_limit"] = 0

field = data.get("memory_limit", None)
if field is not None:
args["memory_limit"] = field
else:
args["memory_limit"] = None
args["memory_limit"] = 0

field = data.get("local_storage_capacity", None)
if field is not None:
args["local_storage_capacity"] = field
else:
args["local_storage_capacity"] = None
args["local_storage_capacity"] = 0

field = data.get("image_uri", None)
if field is not None:
Expand All @@ -218,7 +220,7 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition:
if field is not None:
args["environment_variables"] = field
else:
args["environment_variables"] = None
args["environment_variables"] = {}

field = data.get("created_at", None)
if field is not None:
Expand Down Expand Up @@ -254,13 +256,13 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition:
if field is not None:
args["startup_command"] = field
else:
args["startup_command"] = None
args["startup_command"] = []

field = data.get("args", None)
if field is not None:
args["args"] = field
else:
args["args"] = None
args["args"] = []

field = data.get("region", None)
if field is not None:
Expand Down Expand Up @@ -307,13 +309,13 @@ def unmarshal_JobRun(data: Any) -> JobRun:
if field is not None:
args["state"] = field
else:
args["state"] = None
args["state"] = JobRunState.UNKNOWN_STATE

field = data.get("cpu_limit", None)
if field is not None:
args["cpu_limit"] = field
else:
args["cpu_limit"] = None
args["cpu_limit"] = 0

field = data.get("created_at", None)
if field is not None:
Expand All @@ -337,31 +339,31 @@ def unmarshal_JobRun(data: Any) -> JobRun:
if field is not None:
args["memory_limit"] = field
else:
args["memory_limit"] = None
args["memory_limit"] = 0

field = data.get("local_storage_capacity", None)
if field is not None:
args["local_storage_capacity"] = field
else:
args["local_storage_capacity"] = None
args["local_storage_capacity"] = 0

field = data.get("environment_variables", None)
if field is not None:
args["environment_variables"] = field
else:
args["environment_variables"] = None
args["environment_variables"] = {}

field = data.get("startup_command", None)
if field is not None:
args["startup_command"] = field
else:
args["startup_command"] = None
args["startup_command"] = []

field = data.get("args", None)
if field is not None:
args["args"] = field
else:
args["args"] = None
args["args"] = []

field = data.get("region", None)
if field is not None:
Expand All @@ -387,13 +389,13 @@ def unmarshal_JobRun(data: Any) -> JobRun:
if field is not None:
args["reason"] = field
else:
args["reason"] = None
args["reason"] = JobRunReason.UNKNOWN_REASON

field = data.get("exit_code", None)
if field is not None:
args["exit_code"] = field
else:
args["exit_code"] = None
args["exit_code"] = 0

field = data.get("error_message", None)
if field is not None:
Expand All @@ -411,7 +413,7 @@ def unmarshal_JobRun(data: Any) -> JobRun:
if field is not None:
args["attempts"] = field
else:
args["attempts"] = None
args["attempts"] = 0

return JobRun(**args)

Expand Down
6 changes: 3 additions & 3 deletions scaleway/scaleway/jobs/v1alpha2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,12 @@ class JobRun:
Duration of the job run.
"""

reason: Optional[JobRunReason] = None
reason: Optional[JobRunReason] = JobRunReason.UNKNOWN_REASON
"""
Reason for failure if the job failed.
"""

exit_code: Optional[int] = None
exit_code: Optional[int] = 0
"""
Exit code of the job.
"""
Expand All @@ -389,7 +389,7 @@ class JobRun:
Deprecated, please use startup_command instead.
"""

attempts: Optional[int] = None
attempts: Optional[int] = 0
"""
Number of retry attempts.
"""
Expand Down
Loading