Skip to content

Commit

Permalink
Make Condition and ReplicaStatus optional (#1862)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Iwai <[email protected]>
  • Loading branch information
tenzen-y authored Jul 13, 2023
1 parent 8d8ddba commit 72f2512
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 50 deletions.
4 changes: 0 additions & 4 deletions hack/python-sdk/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@
"kubeflow.org.v1.JobStatus": {
"description": "JobStatus represents the current observed state of the training Job.",
"type": "object",
"required": [
"conditions",
"replicaStatuses"
],
"properties": {
"completionTime": {
"description": "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Expand Down
3 changes: 0 additions & 3 deletions manifests/base/crds/kubeflow.org_mpijobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7845,9 +7845,6 @@ spec:
and is in UTC.
format: date-time
type: string
required:
- conditions
- replicaStatuses
type: object
type: object
served: true
Expand Down
3 changes: 0 additions & 3 deletions manifests/base/crds/kubeflow.org_mxjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7840,9 +7840,6 @@ spec:
and is in UTC.
format: date-time
type: string
required:
- conditions
- replicaStatuses
type: object
type: object
served: true
Expand Down
3 changes: 0 additions & 3 deletions manifests/base/crds/kubeflow.org_paddlejobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8350,9 +8350,6 @@ spec:
and is in UTC.
format: date-time
type: string
required:
- conditions
- replicaStatuses
type: object
type: object
served: true
Expand Down
3 changes: 0 additions & 3 deletions manifests/base/crds/kubeflow.org_pytorchjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8385,9 +8385,6 @@ spec:
and is in UTC.
format: date-time
type: string
required:
- conditions
- replicaStatuses
type: object
type: object
served: true
Expand Down
3 changes: 0 additions & 3 deletions manifests/base/crds/kubeflow.org_tfjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7842,9 +7842,6 @@ spec:
and is in UTC.
format: date-time
type: string
required:
- conditions
- replicaStatuses
type: object
type: object
served: true
Expand Down
3 changes: 0 additions & 3 deletions manifests/base/crds/kubeflow.org_xgboostjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7831,9 +7831,6 @@ spec:
and is in UTC.
format: date-time
type: string
required:
- conditions
- replicaStatuses
type: object
type: object
served: true
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/kubeflow.org/v1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ const (
// JobStatus represents the current observed state of the training Job.
type JobStatus struct {
// Conditions is an array of current observed job conditions.
Conditions []JobCondition `json:"conditions"`
Conditions []JobCondition `json:"conditions,omitempty"`

// ReplicaStatuses is map of ReplicaType and ReplicaStatus,
// specifies the status of each replica.
ReplicaStatuses map[ReplicaType]*ReplicaStatus `json:"replicaStatuses"`
ReplicaStatuses map[ReplicaType]*ReplicaStatus `json:"replicaStatuses,omitempty"`

// Represents time when the job was acknowledged by the job controller.
// It is not guaranteed to be set in happens-before order across separate operations.
Expand Down
1 change: 0 additions & 1 deletion pkg/apis/kubeflow.org/v1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/python/docs/KubeflowOrgV1JobStatus.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ JobStatus represents the current observed state of the training Job.
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**completion_time** | [**datetime**](V1Time.md) | | [optional]
**conditions** | [**list[KubeflowOrgV1JobCondition]**](KubeflowOrgV1JobCondition.md) | Conditions is an array of current observed job conditions. |
**conditions** | [**list[KubeflowOrgV1JobCondition]**](KubeflowOrgV1JobCondition.md) | Conditions is an array of current observed job conditions. | [optional]
**last_reconcile_time** | [**datetime**](V1Time.md) | | [optional]
**replica_statuses** | [**dict(str, KubeflowOrgV1ReplicaStatus)**](KubeflowOrgV1ReplicaStatus.md) | ReplicaStatuses is map of ReplicaType and ReplicaStatus, specifies the status of each replica. |
**replica_statuses** | [**dict(str, KubeflowOrgV1ReplicaStatus)**](KubeflowOrgV1ReplicaStatus.md) | ReplicaStatuses is map of ReplicaType and ReplicaStatus, specifies the status of each replica. | [optional]
**start_time** | [**datetime**](V1Time.md) | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ def __init__(self, completion_time=None, conditions=None, last_reconcile_time=No

if completion_time is not None:
self.completion_time = completion_time
self.conditions = conditions
if conditions is not None:
self.conditions = conditions
if last_reconcile_time is not None:
self.last_reconcile_time = last_reconcile_time
self.replica_statuses = replica_statuses
if replica_statuses is not None:
self.replica_statuses = replica_statuses
if start_time is not None:
self.start_time = start_time

Expand Down Expand Up @@ -111,8 +113,6 @@ def conditions(self, conditions):
:param conditions: The conditions of this KubeflowOrgV1JobStatus. # noqa: E501
:type: list[KubeflowOrgV1JobCondition]
"""
if self.local_vars_configuration.client_side_validation and conditions is None: # noqa: E501
raise ValueError("Invalid value for `conditions`, must not be `None`") # noqa: E501

self._conditions = conditions

Expand Down Expand Up @@ -157,8 +157,6 @@ def replica_statuses(self, replica_statuses):
:param replica_statuses: The replica_statuses of this KubeflowOrgV1JobStatus. # noqa: E501
:type: dict(str, KubeflowOrgV1ReplicaStatus)
"""
if self.local_vars_configuration.client_side_validation and replica_statuses is None: # noqa: E501
raise ValueError("Invalid value for `replica_statuses`, must not be `None`") # noqa: E501

self._replica_statuses = replica_statuses

Expand Down
17 changes: 0 additions & 17 deletions sdk/python/test/test_kubeflow_org_v1_job_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,6 @@ def make_instance(self, include_optional):
)
else :
return KubeflowOrgV1JobStatus(
conditions = [
kubeflow_org_v1_job_condition.KubeflowOrgV1JobCondition(
last_transition_time = None,
last_update_time = None,
message = '0',
reason = '0',
status = '0',
type = '0', )
],
replica_statuses = {
'key' : kubeflow_org_v1_replica_status.KubeflowOrgV1ReplicaStatus(
active = 56,
failed = 56,
label_selector = None,
selector = '0',
succeeded = 56, )
},
)

def testKubeflowOrgV1JobStatus(self):
Expand Down

0 comments on commit 72f2512

Please sign in to comment.