index
int64
0
0
repo_id
stringlengths
26
205
file_path
stringlengths
51
246
content
stringlengths
8
433k
__index_level_0__
int64
0
10k
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/vpc/IpAddressAllocation.java
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.vpc; import java.util.Objects; import javax.validation.Valid; import javax.validation.constraints.Size; import com.netflix.titus.common.model.sanitizer.ClassFieldsNotNull; /** * VPC IP address allocated from Titus IP Service */ @ClassFieldsNotNull public class IpAddressAllocation { @Valid private final IpAddressLocation ipAddressLocation; @Size(min = 1, message = "Empty value not allowed") private final String allocationId; @Size(min = 1, message = "Empty value not allowed") private final String ipAddress; public IpAddressAllocation(IpAddressLocation ipAddressLocation, String allocationId, String ipAddress) { this.ipAddressLocation = ipAddressLocation; this.allocationId = allocationId; this.ipAddress = ipAddress; } public static Builder newBuilder() { return new Builder(); } public Builder toBuilder() { return new Builder(this); } public IpAddressLocation getIpAddressLocation() { return ipAddressLocation; } public String getAllocationId() { return allocationId; } public String getIpAddress() { return ipAddress; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } IpAddressAllocation that = (IpAddressAllocation) o; return Objects.equals(ipAddressLocation, that.ipAddressLocation) && Objects.equals(allocationId, that.allocationId) && Objects.equals(ipAddress, that.ipAddress); } @Override public int hashCode() { return Objects.hash(ipAddressLocation, allocationId, ipAddress); } @Override public String toString() { return "IpAddressAllocation{" + "ipAddressLocation=" + ipAddressLocation + ", allocationId='" + allocationId + '\'' + ", ipAddress=" + ipAddress + '}'; } public static final class Builder { private IpAddressLocation ipAddressLocation; private String allocationId; private String ipAddress; private Builder() { } private Builder(IpAddressAllocation ipAddressAllocation) { this.ipAddressLocation = ipAddressAllocation.getIpAddressLocation(); this.allocationId = ipAddressAllocation.getAllocationId(); this.ipAddress = ipAddressAllocation.getIpAddress(); } public Builder withIpAddressLocation(IpAddressLocation val) { ipAddressLocation = val; return this; } public Builder withUuid(String val) { allocationId = val; return this; } public Builder withIpAddress(String val) { ipAddress = val; return this; } public Builder but() { return newBuilder() .withIpAddressLocation(ipAddressLocation) .withUuid(allocationId) .withIpAddress(ipAddress); } public IpAddressAllocation build() { return new IpAddressAllocation(ipAddressLocation, allocationId, ipAddress); } } }
9,500
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/vpc/IpAddressAllocationUtils.java
/* * Copyright 2021 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.vpc; import java.util.Optional; import com.netflix.titus.api.jobmanager.TaskAttributes; import com.netflix.titus.api.jobmanager.model.job.JobDescriptor; import com.netflix.titus.api.jobmanager.model.job.Task; import com.netflix.titus.common.util.code.CodeInvariants; /** * Helper utilities for processing Static IP related info. */ public class IpAddressAllocationUtils { public static Optional<String> getIpAllocationId(Task task) { return Optional.ofNullable(task.getTaskContext().get(TaskAttributes.TASK_ATTRIBUTES_IP_ALLOCATION_ID)); } public static Optional<String> getIpAllocationZoneForId(String ipAllocationId, JobDescriptor<?> jobDescriptor, CodeInvariants codeInvariants) { for (SignedIpAddressAllocation signedIpAddressAllocation : jobDescriptor.getContainer().getContainerResources().getSignedIpAddressAllocations()) { if (signedIpAddressAllocation.getIpAddressAllocation().getAllocationId().equals(ipAllocationId)) { return Optional.of(signedIpAddressAllocation.getIpAddressAllocation().getIpAddressLocation().getAvailabilityZone()); } } codeInvariants.inconsistent("Unable to find zone for IP allocation ID {} in job allocations {}", ipAllocationId, jobDescriptor.getContainer().getContainerResources().getSignedIpAddressAllocations()); return Optional.empty(); } /** * Returns the zone if the task has an assigned IP address allocation. */ public static Optional<String> getIpAllocationZoneForTask(JobDescriptor<?> jobDescriptor, Task task, CodeInvariants codeInvariants) { return getIpAllocationId(task) .flatMap(ipAllocationId -> getIpAllocationZoneForId(ipAllocationId, jobDescriptor, codeInvariants)); } }
9,501
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/migration/MigrationDetails.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.migration; import java.util.Objects; public class MigrationDetails { private final boolean needsMigration; private final long started; private final long deadline; public MigrationDetails(boolean needsMigration, long started, long deadline) { this.needsMigration = needsMigration; this.started = started; this.deadline = deadline; } public boolean isNeedsMigration() { return needsMigration; } public long getStarted() { return started; } public long getDeadline() { return deadline; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } MigrationDetails that = (MigrationDetails) o; return needsMigration == that.needsMigration && started == that.started && deadline == that.deadline; } @Override public int hashCode() { return Objects.hash(needsMigration, started, deadline); } @Override public String toString() { return "MigrationDetails{" + "needsMigration=" + needsMigration + ", started=" + started + ", deadline=" + deadline + '}'; } public static MigrationDetailsBuilder newBuilder() { return new MigrationDetailsBuilder(); } public static final class MigrationDetailsBuilder { private boolean needsMigration; private long started; private long deadline; private MigrationDetailsBuilder() { } public MigrationDetailsBuilder withNeedsMigration(boolean needsMigration) { this.needsMigration = needsMigration; return this; } public MigrationDetailsBuilder withStarted(long started) { this.started = started; return this; } public MigrationDetailsBuilder withDeadline(long deadline) { this.deadline = deadline; return this; } public MigrationDetailsBuilder but() { return MigrationDetails.newBuilder().withNeedsMigration(needsMigration).withStarted(started).withDeadline(deadline); } public MigrationDetails build() { return new MigrationDetails(needsMigration, started, deadline); } } }
9,502
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/migration/SelfManagedMigrationPolicy.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.migration; /** */ public class SelfManagedMigrationPolicy extends MigrationPolicy { public SelfManagedMigrationPolicy() { super(); } public static Builder newBuilder() { return new Builder(); } @Override public String toString() { return "SelfManagedMigrationPolicy{}"; } public static final class Builder { private Builder() { } public SelfManagedMigrationPolicy build() { return new SelfManagedMigrationPolicy(); } } }
9,503
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/migration/MigrationPolicy.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.migration; /** */ public abstract class MigrationPolicy { protected MigrationPolicy() { } @Override public boolean equals(Object obj) { return this.getClass().equals(obj.getClass()); } @Override public String toString() { return this.getClass().getSimpleName(); } }
9,504
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/migration/SystemDefaultMigrationPolicy.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.migration; /** */ public class SystemDefaultMigrationPolicy extends MigrationPolicy { public SystemDefaultMigrationPolicy() { super(); } public static Builder newBuilder() { return new Builder(); } @Override public String toString() { return "SystemDefaultMigrationPolicy{}"; } public static final class Builder { private Builder() { } public SystemDefaultMigrationPolicy build() { return new SystemDefaultMigrationPolicy(); } } }
9,505
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/volume/SaaSVolumeSource.java
/* * Copyright 2021 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.volume; import java.util.Objects; import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; public class SaaSVolumeSource extends VolumeSource { @NotNull @Pattern(regexp = "[a-z0-9]([-a-z0-9]*[a-z0-9])?", message = "SaaS Volume ID must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character") private final String saaSVolumeID; public SaaSVolumeSource(String saaSVolumeID) { this.saaSVolumeID = saaSVolumeID; } public static SaaSVolumeSource.Builder newBuilder() { return new SaaSVolumeSource.Builder(); } public static SaaSVolumeSource.Builder newBuilder(SaaSVolumeSource saaSVolumeSource) { return new SaaSVolumeSource.Builder() .withSaaSVolumeID(saaSVolumeSource.saaSVolumeID); } public String getSaaSVolumeID() { return saaSVolumeID; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SaaSVolumeSource that = (SaaSVolumeSource) o; return Objects.equals(saaSVolumeID, that.saaSVolumeID); } @Override public int hashCode() { return Objects.hash(saaSVolumeID); } @Override public String toString() { return "SaaSVolumeSource{" + "SaaSVolumeID='" + saaSVolumeID + '\'' + '}'; } public static final class Builder<E extends VolumeSource> { private String saaSVolumeID; public SaaSVolumeSource.Builder<E> withSaaSVolumeID(String saaSVolumeID) { this.saaSVolumeID = saaSVolumeID; return this; } public SaaSVolumeSource build() { return new SaaSVolumeSource( saaSVolumeID ); } } }
9,506
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/volume/VolumeSource.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.volume; public abstract class VolumeSource { }
9,507
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/volume/SharedContainerVolumeSource.java
/* * Copyright 2021 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.volume; import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; public class SharedContainerVolumeSource extends VolumeSource { @NotNull @Pattern(regexp = "[a-z0-9]([-a-z0-9]*[a-z0-9])?", message = "source container must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character") private final String sourceContainer; @NotNull @Pattern(regexp = "^/.*", message = "sourcePath must start with a leading slash") private final String sourcePath; public SharedContainerVolumeSource( String sourceContainer, String sourcePath ) { this.sourceContainer = sourceContainer; this.sourcePath = sourcePath; } public String getSourceContainer() { return sourceContainer; } public String getSourcePath() { return sourcePath; } @Override public String toString() { return "VolumeSource{" + "sourceContainer='" + sourceContainer + '\'' + ", sourcePath='" + sourcePath + '\'' + '}'; } @Override public int hashCode() { return sourceContainer.hashCode() + sourcePath.hashCode(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SharedContainerVolumeSource that = (SharedContainerVolumeSource) o; if (!this.getSourceContainer().equals(that.getSourceContainer())) { return false; } return this.getSourcePath().equals(that.getSourcePath()); } public static Builder newBuilder() { return new SharedContainerVolumeSource.Builder(); } public static Builder newBuilder(SharedContainerVolumeSource sharedContainerVolume) { return new SharedContainerVolumeSource.Builder() .withSourceContainer(sharedContainerVolume.sourceContainer) .withSourcePath(sharedContainerVolume.sourcePath); } public static final class Builder<E extends VolumeSource> { private String sourceContainer; private String sourcePath; public Builder<E> withSourceContainer(String sourceContainer) { this.sourceContainer = sourceContainer; return this; } public Builder<E> withSourcePath(String sourcePath) { this.sourcePath = sourcePath; return this; } public SharedContainerVolumeSource build() { return new SharedContainerVolumeSource( sourceContainer, sourcePath ); } } }
9,508
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/volume/Volume.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.volume; import java.util.Objects; import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; public class Volume { @NotNull @Pattern(regexp = "[a-z0-9]([-a-z0-9]*[a-z0-9])?", message = "volume name must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character") private final String name; @Valid @NotNull private final VolumeSource volumeSource; public Volume(String name, VolumeSource volumeSource) { this.name = name; this.volumeSource = volumeSource; } public String getName() { return name; } public VolumeSource getVolumeSource() { return volumeSource; } @Override public String toString() { return "Volume{" + "name='" + name + '\'' + ", volumeSource='" + volumeSource + '\'' + '}'; } @Override public int hashCode() { return Objects.hash(name, volumeSource.hashCode()); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Volume that = (Volume) o; if (!this.getName().equals(that.getName())) { return false; } return this.getVolumeSource().equals(that.getVolumeSource()); } public Builder toBuilder() { return newBuilder(); } public static Builder newBuilder() { return new Volume.Builder(); } public static final class Builder { private String name; private VolumeSource volumeSource; public Builder withName(String name) { this.name = name; return this; } public Builder withVolumeSource(VolumeSource volumeSource) { this.volumeSource = volumeSource; return this; } public Volume build() { return new Volume(name, volumeSource); } } }
9,509
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/event/JobKeepAliveEvent.java
/* * Copyright 2021 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.event; import java.util.Optional; import com.netflix.titus.api.jobmanager.model.job.Job; import com.netflix.titus.api.model.callmetadata.CallMetadata; public class JobKeepAliveEvent extends JobManagerEvent<Job> { private static final CallMetadata KEEP_ALIVE_CALL_METADATA = CallMetadata.newBuilder() .withCallerId("KeepAliveEvent") .withCallReason("keep alive event") .build(); private final long timestamp; JobKeepAliveEvent(long timestamp) { super(Job.newBuilder().build(), Optional.empty(), false, KEEP_ALIVE_CALL_METADATA); this.timestamp = timestamp; } public long getTimestamp() { return timestamp; } @Override public String toString() { return "JobKeepAliveEvent{" + "timestamp=" + timestamp + '}'; } public static JobKeepAliveEvent keepAliveEvent(long timestamp) { return new JobKeepAliveEvent(timestamp); } }
9,510
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/event/JobManagerEvent.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.event; import java.util.Objects; import java.util.Optional; import com.netflix.titus.api.jobmanager.model.job.Job; import com.netflix.titus.api.jobmanager.service.JobManagerConstants; import com.netflix.titus.api.model.callmetadata.CallMetadata; public abstract class JobManagerEvent<TYPE> { private static final SnapshotMarkerEvent SNAPSHOT_MARKER = new SnapshotMarkerEvent(); private final TYPE current; private final Optional<TYPE> previous; private final boolean archived; private final CallMetadata callMetadata; protected JobManagerEvent(TYPE current, Optional<TYPE> previous, boolean archived, CallMetadata callMetadata) { this.current = current; this.previous = previous; this.archived = archived; this.callMetadata = callMetadata == null ? JobManagerConstants.UNDEFINED_CALL_METADATA : callMetadata; } public TYPE getCurrent() { return current; } public Optional<TYPE> getPrevious() { return previous; } public boolean isArchived() { return archived; } public CallMetadata getCallMetadata() { return callMetadata; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } JobManagerEvent<?> that = (JobManagerEvent<?>) o; return archived == that.archived && Objects.equals(current, that.current) && Objects.equals(previous, that.previous) && Objects.equals(callMetadata, that.callMetadata); } @Override public int hashCode() { return Objects.hash(current, previous, archived, callMetadata); } public static JobManagerEvent<Job> snapshotMarker() { return SNAPSHOT_MARKER; } public static JobManagerEvent<Job> keepAliveEvent(long timestamp) { return new JobKeepAliveEvent(timestamp); } private static class SnapshotMarkerEvent extends JobManagerEvent<Job> { private SnapshotMarkerEvent() { super(Job.newBuilder().build(), Optional.empty(), false, CallMetadata.newBuilder().withCallerId("SnapshotMarkerEvent").withCallReason("initializing").build() ); } } }
9,511
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/event/TaskUpdateEvent.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.event; import java.util.Objects; import java.util.Optional; import com.netflix.titus.api.jobmanager.model.job.Job; import com.netflix.titus.api.jobmanager.model.job.Task; import com.netflix.titus.api.model.callmetadata.CallMetadata; public class TaskUpdateEvent extends JobManagerEvent<Task> { private final Job<?> currentJob; private final boolean movedFromAnotherJob; private TaskUpdateEvent(Job<?> currentJob, Task currentTask, boolean archived, CallMetadata callMetadata, Optional<Task> previousTask) { this(currentJob, currentTask, previousTask, archived, false, callMetadata); } private TaskUpdateEvent(Job<?> currentJob, Task currentTask, Optional<Task> previousTask, boolean archived, boolean moved, CallMetadata callMetadata) { super(currentTask, previousTask, archived, callMetadata); this.currentJob = currentJob; this.movedFromAnotherJob = moved; } public Job<?> getCurrentJob() { return currentJob; } public Task getCurrentTask() { return getCurrent(); } public Optional<Task> getPreviousTask() { return getPrevious(); } public boolean isMovedFromAnotherJob() { return movedFromAnotherJob; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof TaskUpdateEvent)) { return false; } if (!super.equals(o)) { return false; } TaskUpdateEvent that = (TaskUpdateEvent) o; return movedFromAnotherJob == that.movedFromAnotherJob && currentJob.equals(that.currentJob); } @Override public int hashCode() { return Objects.hash(super.hashCode(), currentJob, movedFromAnotherJob); } @Override public String toString() { return "TaskUpdateEvent{" + "currentJob=" + currentJob + ", currentTask=" + getCurrent() + ", previousTask=" + getPrevious() + ", archived=" + isArchived() + ", movedFromAnotherJob=" + movedFromAnotherJob + '}'; } public static TaskUpdateEvent newTask(Job job, Task current, CallMetadata callMetadata) { return new TaskUpdateEvent(job, current, false, callMetadata, Optional.empty()); } public static TaskUpdateEvent newTaskFromAnotherJob(Job job, Task current, CallMetadata callMetadata) { return new TaskUpdateEvent(job, current, Optional.empty(), false, true, callMetadata); } public static TaskUpdateEvent taskChange(Job job, Task current, Task previous, CallMetadata callMetadata) { return new TaskUpdateEvent(job, current, false, callMetadata, Optional.of(previous)); } public static TaskUpdateEvent taskArchived(Job job, Task current, CallMetadata callMetadata) { return new TaskUpdateEvent(job, current, true, callMetadata, Optional.empty()); } }
9,512
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/model/job/event/JobUpdateEvent.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.model.job.event; import java.util.Optional; import com.netflix.titus.api.jobmanager.model.job.Job; import com.netflix.titus.api.model.callmetadata.CallMetadata; public class JobUpdateEvent extends JobManagerEvent<Job> { private JobUpdateEvent(Job current, Optional<Job> previous, boolean archived, CallMetadata callMetadata) { super(current, previous, archived, callMetadata); } @Override public String toString() { return "JobUpdateEvent{" + "current=" + getCurrent() + ", previous=" + getPrevious() + ", archived=" + isArchived() + ", callMetadata" + getCallMetadata() + "}"; } public static JobUpdateEvent newJob(Job current, CallMetadata callMetadata) { return new JobUpdateEvent(current, Optional.empty(), false, callMetadata); } public static JobUpdateEvent jobChange(Job current, Job previous, CallMetadata callMetadata) { return new JobUpdateEvent(current, Optional.of(previous), false, callMetadata); } public static JobUpdateEvent jobArchived(Job archivedJob, CallMetadata callMetadata) { return new JobUpdateEvent(archivedJob, Optional.empty(), true, callMetadata); } }
9,513
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/service/JobManagerException.java
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.service; import java.util.List; import com.netflix.titus.api.jobmanager.model.job.Capacity; import com.netflix.titus.api.jobmanager.model.job.Job; import com.netflix.titus.api.jobmanager.model.job.JobDescriptor; import com.netflix.titus.api.jobmanager.model.job.JobState; import com.netflix.titus.api.jobmanager.model.job.ServiceJobProcesses; import com.netflix.titus.api.jobmanager.model.job.Task; import com.netflix.titus.api.jobmanager.model.job.TaskState; import com.netflix.titus.api.jobmanager.model.job.ebs.EbsVolume; import com.netflix.titus.api.jobmanager.model.job.ext.ServiceJobExt; import com.netflix.titus.api.model.ResourceDimension; import com.netflix.titus.api.model.Tier; import static java.lang.String.format; public class JobManagerException extends RuntimeException { public enum ErrorCode { JobCreateLimited, JobNotFound, NotServiceJobDescriptor, NotServiceJob, NotBatchJobDescriptor, NotBatchJob, UnexpectedJobState, UnexpectedTaskState, TaskNotFound, JobTerminating, TaskTerminating, InvalidContainerResources, InvalidDesiredCapacity, InvalidMaxCapacity, InvalidSequenceId, BelowMinCapacity, AboveMaxCapacity, TerminateAndShrinkNotAllowed, SameJobIds, TaskJobMismatch, NotEnabled, JobsNotCompatible } private final ErrorCode errorCode; private JobManagerException(ErrorCode errorCode, String message) { this(errorCode, message, null); } private JobManagerException(ErrorCode errorCode, String message, Throwable cause) { super(message, cause); this.errorCode = errorCode; } public ErrorCode getErrorCode() { return errorCode; } /** * Returns true, if the argument holds a {@link JobManagerException} instance with an error that may happen during * normal execution (for example 'JobNotFound'). */ public static boolean isExpected(Throwable error) { if (!(error instanceof JobManagerException)) { return false; } switch (((JobManagerException) error).getErrorCode()) { case JobCreateLimited: case JobNotFound: case TaskNotFound: case NotServiceJobDescriptor: case NotServiceJob: case NotBatchJobDescriptor: case NotBatchJob: case JobTerminating: case TaskTerminating: case InvalidContainerResources: case InvalidDesiredCapacity: case InvalidMaxCapacity: case InvalidSequenceId: case BelowMinCapacity: case AboveMaxCapacity: case TerminateAndShrinkNotAllowed: case SameJobIds: case TaskJobMismatch: case NotEnabled: return true; case UnexpectedJobState: case UnexpectedTaskState: return false; } return false; } public static boolean hasErrorCode(Throwable error, ErrorCode errorCode) { return (error instanceof JobManagerException) && ((JobManagerException) error).getErrorCode() == errorCode; } public static JobManagerException jobCreateLimited(String violation) { return new JobManagerException(ErrorCode.JobCreateLimited, violation); } public static JobManagerException invalidSequenceId(String violation) { return new JobManagerException(ErrorCode.InvalidSequenceId, violation); } public static JobManagerException jobNotFound(String jobId) { return new JobManagerException(ErrorCode.JobNotFound, format("Job with id %s does not exist", jobId)); } public static JobManagerException v3JobNotFound(String jobId) { return new JobManagerException(ErrorCode.JobNotFound, format("Job with id %s does not exist, or is running on the V2 engine", jobId)); } public static JobManagerException unexpectedJobState(Job job, JobState expectedState) { return new JobManagerException( ErrorCode.UnexpectedJobState, format("Job %s is not in the expected state %s (expected) != %s (actual)", job.getId(), expectedState, job.getStatus().getState()) ); } public static JobManagerException taskNotFound(String taskId) { return new JobManagerException(ErrorCode.TaskNotFound, format("Task with id %s does not exist", taskId)); } public static JobManagerException notServiceJobDescriptor(JobDescriptor<?> jobDescriptor) { return new JobManagerException(ErrorCode.NotServiceJobDescriptor, format("Operation restricted to service job descriptors, but got: %s", jobDescriptor)); } public static JobManagerException notServiceJob(String jobId) { return new JobManagerException(ErrorCode.NotServiceJob, format("Operation restricted to service jobs, and %s is not a service job", jobId)); } public static JobManagerException notBatchJobDescriptor(JobDescriptor<?> jobDescriptor) { return new JobManagerException(ErrorCode.NotBatchJobDescriptor, format("Operation restricted to batch job descriptors, but got: %s", jobDescriptor)); } public static JobManagerException notBatchJob(String jobId) { return new JobManagerException(ErrorCode.NotBatchJob, format("Operation restricted to batch jobs, and %s is not a batch job", jobId)); } public static JobManagerException unexpectedTaskState(Task task, TaskState expectedState) { return new JobManagerException( ErrorCode.UnexpectedTaskState, format("Task %s is not in the expected state %s (expected) != %s (actual)", task.getId(), expectedState, task.getStatus().getState()) ); } public static Throwable jobTerminating(Job<?> job) { if (job.getStatus().getState() == JobState.Finished) { return new JobManagerException(ErrorCode.JobTerminating, format("Job %s is terminated", job.getId())); } return new JobManagerException(ErrorCode.JobTerminating, format("Job %s is in the termination process", job.getId())); } public static Throwable taskTerminating(Task task) { if (task.getStatus().getState() == TaskState.Finished) { return new JobManagerException(ErrorCode.TaskTerminating, format("Task %s is terminated", task.getId())); } return new JobManagerException(ErrorCode.TaskTerminating, format("Task %s is in the termination process", task.getId())); } public static JobManagerException invalidContainerResources(Tier tier, ResourceDimension requestedResources, List<ResourceDimension> tierResourceLimits) { return new JobManagerException( ErrorCode.InvalidContainerResources, format("Job too large to run in the %s tier: requested=%s, limits=%s", tier, requestedResources, tierResourceLimits) ); } public static JobManagerException invalidContainerResources(EbsVolume ebsVolume, String message) { return new JobManagerException( ErrorCode.InvalidContainerResources, format("Job has invalid EBS volume: volume id=%s, reason=%s", ebsVolume.getVolumeId(), message) ); } public static JobManagerException invalidDesiredCapacity(String jobId, int targetDesired, ServiceJobProcesses serviceJobProcesses) { return new JobManagerException( ErrorCode.InvalidDesiredCapacity, format("Job %s can not be updated to desired capacity of %s, disableIncreaseDesired %s, disableDecreaseDesired %s", jobId, targetDesired, serviceJobProcesses.isDisableIncreaseDesired(), serviceJobProcesses.isDisableDecreaseDesired()) ); } public static JobManagerException invalidMaxCapacity(String jobId, int targetMax, int ipAllocations) { return new JobManagerException( ErrorCode.InvalidMaxCapacity, format("Job %s can not be updated to max capacity of %d due to only %d IP allocations", jobId, targetMax, ipAllocations) ); } public static JobManagerException belowMinCapacity(Job<ServiceJobExt> job, int decrement) { Capacity capacity = job.getJobDescriptor().getExtensions().getCapacity(); return new JobManagerException( ErrorCode.BelowMinCapacity, format("Cannot decrement job %s desired size by %s, as it violates the minimum job size constraint: min=%s, desired=%d, max=%d", job.getId(), decrement, capacity.getMin(), capacity.getDesired(), capacity.getMax() ) ); } public static JobManagerException aboveMaxCapacity(Job<ServiceJobExt> job, int increment) { Capacity capacity = job.getJobDescriptor().getExtensions().getCapacity(); return new JobManagerException( ErrorCode.AboveMaxCapacity, format("Cannot increment job %s desired size by %s, as it violates the maximum job size constraint: min=%s, desired=%d, max=%d", job.getId(), increment, capacity.getMin(), capacity.getDesired(), capacity.getMax() ) ); } public static JobManagerException terminateAndShrinkNotAllowed(Job<ServiceJobExt> job, Task task) { Capacity capacity = job.getJobDescriptor().getExtensions().getCapacity(); return new JobManagerException( ErrorCode.TerminateAndShrinkNotAllowed, format("Terminate and shrink would make desired job size go below the configured minimum, which is not allowed for this request: jobId=%s, taskId=%s, min=%s, desired=%d, max=%d", job.getId(), task.getId(), capacity.getMin(), capacity.getDesired(), capacity.getMax() ) ); } public static JobManagerException sameJobs(String jobId) { return new JobManagerException( ErrorCode.SameJobIds, format("Operation requires two different job, but the same job was provided as the source and target: %s", jobId) ); } public static JobManagerException taskJobMismatch(String jobId, String taskId) { return new JobManagerException( ErrorCode.TaskJobMismatch, format("Operation requires task id to belong to the source job id. Task with id %s does not belong to job with id %s", taskId, jobId) ); } public static JobManagerException notCompatible(Job<ServiceJobExt> jobFrom, Job<ServiceJobExt> jobTo, String details) { return new JobManagerException( ErrorCode.JobsNotCompatible, format("Operation requires jobs to be compatible: %s -> %s\n%s", jobFrom.getId(), jobTo.getId(), details) ); } public static JobManagerException notEnabled(String taskAction) { return new JobManagerException( ErrorCode.NotEnabled, format("%s not enabled", taskAction) ); } }
9,514
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/service/ReadOnlyJobOperations.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.service; import java.util.List; import java.util.Optional; import java.util.function.Predicate; import com.netflix.titus.api.jobmanager.model.job.Job; import com.netflix.titus.api.jobmanager.model.job.Task; import com.netflix.titus.api.jobmanager.model.job.event.JobManagerEvent; import com.netflix.titus.common.util.rx.ReactorExt; import com.netflix.titus.common.util.tuple.Pair; import reactor.core.publisher.Flux; import rx.Observable; import static com.netflix.titus.common.util.FunctionExt.alwaysTrue; /** * An interface providing the read-only view into the job data. */ public interface ReadOnlyJobOperations { List<Job> getJobs(); Optional<Job<?>> getJob(String jobId); List<Task> getTasks(); List<Task> getTasks(String jobId); List<Pair<Job, List<Task>>> getJobsAndTasks(); List<Job<?>> findJobs(Predicate<Pair<Job<?>, List<Task>>> queryPredicate, int offset, int limit); List<Pair<Job<?>, Task>> findTasks(Predicate<Pair<Job<?>, Task>> queryPredicate, int offset, int limit); Optional<Pair<Job<?>, Task>> findTaskById(String taskId); default Observable<JobManagerEvent<?>> observeJobs() { return observeJobs(alwaysTrue(), alwaysTrue(), false); } Observable<JobManagerEvent<?>> observeJobs(Predicate<Pair<Job<?>, List<Task>>> jobsPredicate, Predicate<Pair<Job<?>, Task>> tasksPredicate, boolean withCheckpoints); Observable<JobManagerEvent<?>> observeJob(String jobId); default Flux<JobManagerEvent<?>> observeJobsReactor() { return ReactorExt.toFlux(observeJobs(alwaysTrue(), alwaysTrue(), false)); } default Flux<JobManagerEvent<?>> observeJobsReactor(Predicate<Pair<Job<?>, List<Task>>> jobsPredicate, Predicate<Pair<Job<?>, Task>> tasksPredicate) { return ReactorExt.toFlux(observeJobs(jobsPredicate, tasksPredicate, false)); } default Flux<JobManagerEvent<?>> observeJobReactor(String jobId) { return ReactorExt.toFlux(observeJob(jobId)); } }
9,515
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/service/JobManagerConstants.java
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.service; import com.netflix.titus.api.model.callmetadata.CallMetadata; /** * Constant keys for Job Manager attributes. */ public class JobManagerConstants { /** * Call metadata attribute used when a new job is created. */ public static final String JOB_MANAGER_ATTRIBUTE_CALLMETADATA = "callmetadata"; /** * Call metadata for a reconciler job/task mutation */ public static final CallMetadata RECONCILER_CALLMETADATA = CallMetadata.newBuilder().withCallerId("Reconciler").build(); /** * Call metadata for a scheduler job/task mutation */ public static final CallMetadata SCHEDULER_CALLMETADATA = CallMetadata.newBuilder().withCallerId("Scheduler").build(); /** * Call metadata for an undefined job/task mutation */ public static final CallMetadata UNDEFINED_CALL_METADATA = CallMetadata.newBuilder().withCallerId("Unknown").withCallReason("Unknown").build(); /** * Call metadata for replicator event stream */ public static final CallMetadata GRPC_REPLICATOR_CALL_METADATA = CallMetadata.newBuilder().withCallerId("JobReplictorEvent").withCallReason("Replication").build(); }
9,516
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/service/V3JobOperations.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.service; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.function.Function; import com.netflix.titus.api.jobmanager.model.job.CapacityAttributes; import com.netflix.titus.api.jobmanager.model.job.JobDescriptor; import com.netflix.titus.api.jobmanager.model.job.ServiceJobProcesses; import com.netflix.titus.api.jobmanager.model.job.Task; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.DisruptionBudget; import com.netflix.titus.api.model.callmetadata.CallMetadata; import com.netflix.titus.common.util.rx.ReactorExt; import reactor.core.publisher.Mono; import rx.Completable; import rx.Observable; public interface V3JobOperations extends ReadOnlyJobOperations { String COMPONENT = "jobManagement"; enum Trigger { API, ComputeProvider, Reconciler, ReconcilerServiceTaskRemoved, Scheduler, TaskMigration, Eviction, Kube, } /** * @deprecated Use {@link #createJobReactor(JobDescriptor, CallMetadata)}. */ Observable<String> createJob(JobDescriptor<?> jobDescriptor, CallMetadata callMetadata); default Mono<String> createJobReactor(JobDescriptor<?> jobDescriptor, CallMetadata callMetadata) { return ReactorExt.toMono(createJob(jobDescriptor, callMetadata).toSingle()); } /** * @deprecated Use {@link #updateJobCapacityAttributesReactor(String, CapacityAttributes, CallMetadata)} */ Observable<Void> updateJobCapacityAttributes(String jobId, CapacityAttributes capacityAttributes, CallMetadata callMetadata); default Mono<Void> updateJobCapacityAttributesReactor(String jobId, CapacityAttributes capacityAttributes, CallMetadata callMetadata) { return ReactorExt.toMono(updateJobCapacityAttributes(jobId, capacityAttributes, callMetadata)); } /** * @deprecated Use {@link #updateServiceJobProcessesReactor(String, ServiceJobProcesses, CallMetadata)} */ Observable<Void> updateServiceJobProcesses(String jobId, ServiceJobProcesses serviceJobProcesses, CallMetadata callMetadata); default Mono<Void> updateServiceJobProcessesReactor(String jobId, ServiceJobProcesses serviceJobProcesses, CallMetadata callMetadata) { return ReactorExt.toMono(updateServiceJobProcesses(jobId, serviceJobProcesses, callMetadata)); } /** * @deprecated Use {@link #updateJobStatusReactor(String, boolean, CallMetadata)} */ Observable<Void> updateJobStatus(String serviceJobId, boolean enabled, CallMetadata callMetadata); default Mono<Void> updateJobStatusReactor(String serviceJobId, boolean enabled, CallMetadata callMetadata) { return ReactorExt.toMono(updateJobStatus(serviceJobId, enabled, callMetadata)); } Mono<Void> updateJobDisruptionBudget(String jobId, DisruptionBudget disruptionBudget, CallMetadata callMetadata); Mono<Void> updateJobAttributes(String jobId, Map<String, String> attributes, CallMetadata callMetadata); Mono<Void> deleteJobAttributes(String jobId, Set<String> keys, CallMetadata callMetadata); /** * @deprecated Use {@link #killJobReactor(String, String, CallMetadata)} */ Observable<Void> killJob(String jobId, String reason, CallMetadata callMetadata); // TODO: get rid of the reason default Mono<Void> killJobReactor(String jobId, String reason, CallMetadata callMetadata) { return ReactorExt.toMono(killJob(jobId, reason, callMetadata)); } Mono<Void> killTask(String taskId, boolean shrink, boolean preventMinSizeUpdate, Trigger trigger, CallMetadata callMetadata); /** * Move a task from one service job to another. */ Observable<Void> moveServiceTask(String sourceJobId, String targetJobId, String taskId, CallMetadata callMetadata); /** * Applies the provided update function to a task before persisting it to a store. In case of system failure * the update may be lost. */ Completable updateTask(String taskId, Function<Task, Optional<Task>> changeFunction, Trigger trigger, String reason, CallMetadata callMetadata); }
9,517
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/JobStoreFitAction.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store; import java.util.HashSet; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.function.Supplier; import com.google.common.base.Preconditions; import com.netflix.titus.api.jobmanager.TaskAttributes; import com.netflix.titus.api.jobmanager.model.job.Job; import com.netflix.titus.api.jobmanager.model.job.JobDescriptor; import com.netflix.titus.api.jobmanager.model.job.Task; import com.netflix.titus.api.jobmanager.model.job.TwoLevelResource; import com.netflix.titus.common.framework.fit.AbstractFitAction; import com.netflix.titus.common.framework.fit.FitActionDescriptor; import com.netflix.titus.common.framework.fit.FitInjection; import com.netflix.titus.common.framework.fit.FitUtil; import com.netflix.titus.common.util.CollectionsExt; import com.netflix.titus.common.util.StringExt; public class JobStoreFitAction extends AbstractFitAction { public enum ErrorKind { /** * Drop job ids when loading from the database. Jobs with dropped ids will not be loaded. */ LostJobIds, /** * Create phantom job ids, and inject them when loading the data from the database. */ PhantomJobIds, /** * Drop task ids when loading from the database. Tasks with dropped ids will not be loaded. */ LostTaskIds, /** * Create phantom tasks ids, and inject them when loading the data from the database. */ PhantomTaskIds, /** * Change {@link Job} instances such that they fail the validation rules. */ CorruptedJobRecords, /** * Change serialized job data, so it cannot be parsed, and mapped into {@link Job} object. */ CorruptedRawJobRecords, /** * Change {@link Task} instances such that they fail the validation rules. */ CorruptedTaskRecords, /** * Change serialized task data, so it cannot be parsed, and mapped into {@link Task} object. */ CorruptedRawTaskRecords, /** * Duplicate ENI assignments by copying them between tasks which are loaded from the database. */ DuplicatedEni, /** * Change/remove assigned resources (IP, ENI) for a launched task. */ CorruptedTaskPlacementData } private final Set<ErrorKind> failurePoints; private final Supplier<Boolean> shouldFailFunction; public static final FitActionDescriptor DESCRIPTOR = new FitActionDescriptor( "jobStore", "Inject failures in JobStore", CollectionsExt.copyAndAdd( FitUtil.PERIOD_ERROR_PROPERTIES, "errorKinds", "A list of: " + StringExt.concatenate(ErrorKind.values(), ",") ) ); private final ConcurrentMap<String, ConcurrentMap<Integer, TwoLevelResource>> twoLevelResourceAssignments = new ConcurrentHashMap<>(); public JobStoreFitAction(String id, Map<String, String> properties, FitInjection injection) { super(id, DESCRIPTOR, properties, injection); String errorKindsValue = properties.get("errorKinds"); Preconditions.checkArgument(errorKindsValue != null, "Missing 'errorKinds' property"); this.failurePoints = new HashSet<>(StringExt.parseEnumListIgnoreCase(errorKindsValue, ErrorKind.class)); this.shouldFailFunction = FitUtil.periodicErrors(properties); } @Override public <T> T afterImmediate(String injectionPoint, T result) { if (result == null) { return null; } ErrorKind errorKind = ErrorKind.valueOf(injectionPoint); if (shouldFailFunction.get() && failurePoints.contains(errorKind)) { switch (errorKind) { case LostJobIds: case LostTaskIds: return handleLostIds(result); case PhantomJobIds: case PhantomTaskIds: return handlePhantomIds(result); case CorruptedJobRecords: return handleCorruptedJobRecords(result); case CorruptedTaskRecords: return handleCorruptedTaskRecords(result); case CorruptedRawJobRecords: case CorruptedRawTaskRecords: return handleCorruptedRawData(result); case DuplicatedEni: return handleDuplicatedEni(result, false); case CorruptedTaskPlacementData: return handleCorruptedTaskPlacementData(result); } return result; } // Do nothing switch (errorKind) { case LostJobIds: case LostTaskIds: case CorruptedJobRecords: case CorruptedRawJobRecords: case CorruptedTaskRecords: case CorruptedRawTaskRecords: case CorruptedTaskPlacementData: case PhantomJobIds: case PhantomTaskIds: return result; case DuplicatedEni: return handleDuplicatedEni(result, true); } return result; } private <T> T handleLostIds(T result) { return null; } private <T> T handlePhantomIds(T result) { return (T) UUID.randomUUID().toString(); } private <T> T handleCorruptedJobRecords(T result) { if (result instanceof Job) { JobDescriptor changedJobDescriptor = ((Job<?>) result).getJobDescriptor().toBuilder().withContainer(null).build(); return (T) (Job<?>) ((Job<?>) result).toBuilder().withJobDescriptor(changedJobDescriptor).build(); } return result; } private <T> T handleCorruptedTaskRecords(T result) { if (result instanceof Task) { Task changedTask = ((Task) result).toBuilder().withStatus(null).build(); return (T) changedTask; } return result; } private <T> T handleCorruptedRawData(T result) { return result instanceof String ? (T) ("BadJSON" + result) : result; } private <T> T handleDuplicatedEni(T result, boolean storeOnly) { if (!(result instanceof Task)) { return result; } Task task = (Task) result; if (task.getTwoLevelResources().isEmpty()) { return result; } TwoLevelResource original = task.getTwoLevelResources().get(0); synchronized (twoLevelResourceAssignments) { // Store current assignment ConcurrentMap<Integer, TwoLevelResource> agentAssignments = twoLevelResourceAssignments.computeIfAbsent( task.getTaskContext().getOrDefault(TaskAttributes.TASK_ATTRIBUTES_AGENT_HOST, "DEFAULT"), k -> new ConcurrentHashMap<>() ); agentAssignments.put(original.getIndex(), original); if (storeOnly) { return result; } // Find another assignment on the same agent with different resource value Optional<Task> taskOverride = agentAssignments.values().stream().filter(a -> !a.getValue().equals(original.getValue())) .findFirst() .map(match -> { TwoLevelResource override = original.toBuilder().withIndex(match.getIndex()).build(); return task.toBuilder().withTwoLevelResources(override).build(); }); return (T) taskOverride.orElse(task); } } private <T> T handleCorruptedTaskPlacementData(T result) { if (!(result instanceof Task)) { return result; } Task task = (Task) result; Map<String, String> corruptedTaskContext = CollectionsExt.copyAndRemove( task.getTaskContext(), TaskAttributes.TASK_ATTRIBUTES_CONTAINER_IP, TaskAttributes.TASK_ATTRIBUTES_AGENT_HOST ); return (T) task.toBuilder().withTaskContext(corruptedTaskContext).build(); } }
9,518
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/JobStore.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store; import java.util.List; import com.netflix.titus.api.jobmanager.model.job.Job; import com.netflix.titus.api.jobmanager.model.job.Task; import com.netflix.titus.common.util.tuple.Pair; import rx.Completable; import rx.Observable; /** * Provides an abstraction to the underlying datastore. */ public interface JobStore { /** * Initialize the store. */ Completable init(); /** * Retrieve all jobs. The result contains also number of records that could not be loaded from the database or * which were corrupted and could not be mapped to {@link Job} instance. * * @return all the jobs. */ Observable<Pair<List<Job<?>>, Integer>> retrieveJobs(); /** * Retrieve the job with the specified jobId. * * @param jobId * @return the job or an error if it does not exist. */ Observable<Job<?>> retrieveJob(String jobId); /** * Store a new job. * * @param job */ Completable storeJob(Job job); /** * Update an existing job. * * @param job */ Completable updateJob(Job job); /** * Delete a job * * @param job */ Completable deleteJob(Job job); /** * Retrieve all the tasks for a specific job. * * @param jobId * @return the tasks for the job. */ Observable<Pair<List<Task>, Integer>> retrieveTasksForJob(String jobId); /** * Retrieve a specific task. * * @param taskId * @return the task or an error if it is not found. */ Observable<Task> retrieveTask(String taskId); /** * Store a new task. * * @param task */ Completable storeTask(Task task); /** * Update an existing task. * * @param task */ Completable updateTask(Task task); /** * Replace an existing task. * * @param oldTask * @param newTask */ Completable replaceTask(Task oldTask, Task newTask); /** * Move an existing task between two existing jobs. * * @param jobFrom * @param jobTo * @param task entity to be persisted in its final state after moved to jobTo */ Completable moveTask(Job jobFrom, Job jobTo, Task task); /** * Delete an existing task. * * @param task */ Completable deleteTask(Task task); /** * Retrieve the archived job with the specified jobId. * * @param jobId * @return the job or an error if it does not exist. */ Observable<Job<?>> retrieveArchivedJob(String jobId); /** * Retrieve all the archived tasks for a specific job. * * @param jobId * @return the archived tasks for the job. */ Observable<Task> retrieveArchivedTasksForJob(String jobId); /** * Retrieve a specific archived task. * * @param taskId * @return the task or an error if it is not found. */ Observable<Task> retrieveArchivedTask(String taskId); /** * Retrieve all the archived tasks for a specific job. * * @param jobId * @return the count of archived tasks for a specific job. */ Observable<Long> retrieveArchivedTaskCountForJob(String jobId); /** * Delete an archived task record. * * @param taskId */ Completable deleteArchivedTask(String jobId, String taskId); }
9,519
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/JobStoreException.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store; import java.util.Set; import com.netflix.titus.common.model.sanitizer.ValidationError; import static java.lang.String.format; /** * A custom runtime exception that indicates an error in the job store. */ public class JobStoreException extends RuntimeException { public enum ErrorCode { CASSANDRA_DRIVER_ERROR, BAD_DATA, JOB_ALREADY_EXISTS, JOB_MUST_BE_ACTIVE, JOB_DOES_NOT_EXIST, TASK_DOES_NOT_EXIST } private final ErrorCode errorCode; private JobStoreException(String message, ErrorCode errorCode) { this(message, errorCode, null); } private JobStoreException(String message, ErrorCode errorCode, Throwable cause) { super(message, cause); this.errorCode = errorCode; } public ErrorCode getErrorCode() { return errorCode; } public static JobStoreException jobMustBeActive(String jobId) { return new JobStoreException(format("Job with jobId: %s must be active", jobId), ErrorCode.JOB_MUST_BE_ACTIVE); } public static JobStoreException jobAlreadyExists(String jobId) { return new JobStoreException(format("Job with jobId: %s already exists", jobId), ErrorCode.JOB_ALREADY_EXISTS); } public static JobStoreException jobDoesNotExist(String jobId) { return new JobStoreException(format("Job with jobId: %s does not exist", jobId), ErrorCode.JOB_DOES_NOT_EXIST); } public static JobStoreException taskDoesNotExist(String taskId) { return new JobStoreException(format("Task with taskId: %s does not exist", taskId), ErrorCode.TASK_DOES_NOT_EXIST); } public static JobStoreException cassandraDriverError(Throwable e) { return new JobStoreException(e.getMessage(), ErrorCode.CASSANDRA_DRIVER_ERROR, e); } public static <T> JobStoreException badData(T value, Set<ValidationError> violations) { return new JobStoreException( String.format("Entity %s violates constraints: %s", value, violations), ErrorCode.BAD_DATA ); } }
9,520
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/DisruptionBudgetMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.List; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.ContainerHealthProvider; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.DisruptionBudgetPolicy; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.DisruptionBudgetRate; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.TimeWindow; public abstract class DisruptionBudgetMixIn { @JsonCreator public DisruptionBudgetMixIn(@JsonProperty("disruptionBudgetPolicy") DisruptionBudgetPolicy disruptionBudgetPolicy, @JsonProperty("disruptionBudgetRate") DisruptionBudgetRate disruptionBudgetRate, @JsonProperty("timeWindows") List<TimeWindow> timeWindows, @JsonProperty("containerHealthProviders") List<ContainerHealthProvider> containerHealthProviders) { } }
9,521
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/BasicContainerMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.netflix.titus.api.jobmanager.model.job.Image; import com.netflix.titus.api.jobmanager.model.job.VolumeMount; public abstract class BasicContainerMixin { @JsonCreator public BasicContainerMixin(@JsonProperty("name") String name, @JsonProperty("image") Image image, @JsonProperty("entryPoint") List<String> entryPoint, @JsonProperty("command") List<String> command, @JsonProperty("env") Map<String, String> env, @JsonSetter(nulls = Nulls.AS_EMPTY) @JsonProperty("volumeMounts") List<VolumeMount> volumeMounts ) { } }
9,522
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/RatePercentagePerIntervalDisruptionBudgetRateMixIn.java
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class RatePercentagePerIntervalDisruptionBudgetRateMixIn { public RatePercentagePerIntervalDisruptionBudgetRateMixIn(@JsonProperty("intervalMs") long intervalMs, @JsonProperty("percentageLimitPerInterval") double percentageLimitPerInterval) { } }
9,523
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/BatchJobTaskMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.List; import java.util.Map; import java.util.Optional; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.TaskStatus; import com.netflix.titus.api.jobmanager.model.job.TwoLevelResource; import com.netflix.titus.api.jobmanager.model.job.Version; public abstract class BatchJobTaskMixin { @JsonCreator BatchJobTaskMixin(@JsonProperty("id") String id, @JsonProperty("index") int index, @JsonProperty("originalId") String originalId, @JsonProperty("resubmitOf") Optional<String> resubmitOf, @JsonProperty("jobId") String jobId, @JsonProperty("resubmitNumber") int resubmitNumber, @JsonProperty("systemResubmitNumber") int systemResubmitNumber, @JsonProperty("evictionResubmitNumber") int evictionResubmitNumber, @JsonProperty("status") TaskStatus status, @JsonProperty("statusHistory") List<TaskStatus> statusHistory, @JsonProperty("twoLevelResources") List<TwoLevelResource> twoLevelResources, @JsonProperty("taskContext") Map<String, String> taskContext, @JsonProperty("attributes") Map<String, String> attributes, @JsonProperty("version") Version version) { } }
9,524
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/CapacityMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class CapacityMixin { @JsonCreator protected CapacityMixin(@JsonProperty("min") int min, @JsonProperty("desired") int desired, @JsonProperty("max") int max) { } }
9,525
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/SystemDefaultMigrationPolicyMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; public abstract class SystemDefaultMigrationPolicyMixin { @JsonCreator public SystemDefaultMigrationPolicyMixin() { } }
9,526
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/RelocationLimitDisruptionBudgetPolicyMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class RelocationLimitDisruptionBudgetPolicyMixIn { @JsonCreator public RelocationLimitDisruptionBudgetPolicyMixIn(@JsonProperty("limit") int limit) { } }
9,527
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/UnhealthyTasksLimitDisruptionBudgetPolicyMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class UnhealthyTasksLimitDisruptionBudgetPolicyMixIn { @JsonCreator public UnhealthyTasksLimitDisruptionBudgetPolicyMixIn(@JsonProperty("limitOfUnhealthyContainers") int limitOfUnhealthyContainers) { } }
9,528
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/ImmediateRetryPolicyMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class ImmediateRetryPolicyMixin { @JsonCreator public ImmediateRetryPolicyMixin(@JsonProperty("retries") int retries) { } }
9,529
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/ServiceJobExtMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.Capacity; import com.netflix.titus.api.jobmanager.model.job.ServiceJobProcesses; import com.netflix.titus.api.jobmanager.model.job.migration.MigrationPolicy; import com.netflix.titus.api.jobmanager.model.job.retry.RetryPolicy; public abstract class ServiceJobExtMixin { @JsonCreator protected ServiceJobExtMixin(@JsonProperty("capacity") Capacity capacity, @JsonProperty("enabled") boolean enabled, @JsonProperty("retryPolicy") RetryPolicy retryPolicy, @JsonProperty("serviceJobProcesses") ServiceJobProcesses serviceJobProcesses, @JsonProperty("migrationPolicy") MigrationPolicy migrationPolicy) { } }
9,530
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/SaaSVolumeSourceMixin.java
/* * Copyright 2021 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public class SaaSVolumeSourceMixin { @JsonCreator public SaaSVolumeSourceMixin( @JsonProperty("saaSVolumeID") String saaSVolumeID ) { } }
9,531
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/PlatformSidecarMixin.java
package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.protobuf.Struct; public class PlatformSidecarMixin { @JsonCreator public PlatformSidecarMixin( @JsonProperty("name") String name, @JsonProperty("channel") String channel, @JsonProperty("arguments") String arguments ) { } }
9,532
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/PercentagePerHourDisruptionBudgetRateMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class PercentagePerHourDisruptionBudgetRateMixIn { @JsonCreator public PercentagePerHourDisruptionBudgetRateMixIn( @JsonProperty("maxPercentageOfContainersRelocatedInHour") double maxPercentageOfContainersRelocatedInHour) { } }
9,533
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/JobMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.List; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.JobDescriptor; import com.netflix.titus.api.jobmanager.model.job.JobStatus; import com.netflix.titus.api.jobmanager.model.job.Version; public abstract class JobMixin { @JsonCreator JobMixin(@JsonProperty("id") String id, @JsonProperty("jobDescriptor") JobDescriptor jobDescriptor, @JsonProperty("status") JobStatus status, @JsonProperty("statusHistory") List<JobStatus> statusHistory, @JsonProperty("version") Version version) { } }
9,534
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/TaskStatusMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.TaskState; public abstract class TaskStatusMixin { @JsonCreator public TaskStatusMixin(@JsonProperty("taskState") TaskState taskState, @JsonProperty("reasonCode") String reasonCode, @JsonProperty("reasonMessage") String reasonMessage, @JsonProperty("timestamp") long timestamp) { } }
9,535
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/VolumeMountMixin.java
package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public class VolumeMountMixin { @JsonCreator public VolumeMountMixin( @JsonProperty("volumeName") String volumeName, @JsonProperty("mountPath") String mountPath, @JsonProperty("mountPropagation") String mountPropagation, @JsonProperty("readOnly") Boolean readOnly, @JsonProperty("subPath") String subPath ) { } }
9,536
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/SignedIpAddressAllocationMixin.java
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.vpc.IpAddressAllocation; public abstract class SignedIpAddressAllocationMixin { @JsonCreator public SignedIpAddressAllocationMixin(@JsonProperty("ipAddressAllocation") IpAddressAllocation ipAddressAllocation, @JsonProperty("authoritativePublicKey") byte[] authoritativePublicKey, @JsonProperty("hostPublicKey") byte[] hostPublicKey, @JsonProperty("hostPublicKeySignature") byte[] hostPublicKeySignature, @JsonProperty("message") byte[] message, @JsonProperty("messageSignature") byte[] messageSignature) { } }
9,537
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/MigrationPolicyMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.netflix.titus.api.jobmanager.model.job.migration.SelfManagedMigrationPolicy; import com.netflix.titus.api.jobmanager.model.job.migration.SystemDefaultMigrationPolicy; @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = SystemDefaultMigrationPolicy.class, name = "systemDefaultMigrationPolicy"), @JsonSubTypes.Type(value = SelfManagedMigrationPolicy.class, name = "selfManagedMigrationPolicy"), }) public abstract class MigrationPolicyMixin { }
9,538
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/VolumeMixin.java
package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.netflix.titus.api.jobmanager.model.job.volume.VolumeSource; public abstract class VolumeMixin { @JsonCreator public VolumeMixin( @JsonProperty("name") String name, @JsonProperty("volumeSource") VolumeSource volumeSource ) { } }
9,539
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/DisruptionBudgetPolicyMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.AvailabilityPercentageLimitDisruptionBudgetPolicy; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RelocationLimitDisruptionBudgetPolicy; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.SelfManagedDisruptionBudgetPolicy; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnhealthyTasksLimitDisruptionBudgetPolicy; @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = AvailabilityPercentageLimitDisruptionBudgetPolicy.class, name = "availabilityPercentageLimit"), @JsonSubTypes.Type(value = SelfManagedDisruptionBudgetPolicy.class, name = "selfManaged"), @JsonSubTypes.Type(value = UnhealthyTasksLimitDisruptionBudgetPolicy.class, name = "unhealthyTasksLimit"), @JsonSubTypes.Type(value = RelocationLimitDisruptionBudgetPolicy.class, name = "relocationLimit") }) public abstract class DisruptionBudgetPolicyMixIn { }
9,540
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/DisruptionBudgetRateMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.PercentagePerHourDisruptionBudgetRate; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RatePerIntervalDisruptionBudgetRate; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RatePercentagePerIntervalDisruptionBudgetRate; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnlimitedDisruptionBudgetRate; @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = PercentagePerHourDisruptionBudgetRate.class, name = "percentagePerHour"), @JsonSubTypes.Type(value = RatePerIntervalDisruptionBudgetRate.class, name = "ratePerInterval"), @JsonSubTypes.Type(value = RatePercentagePerIntervalDisruptionBudgetRate.class, name = "ratePercentagePerInterval"), @JsonSubTypes.Type(value = UnlimitedDisruptionBudgetRate.class, name = "unlimited") }) public abstract class DisruptionBudgetRateMixIn { }
9,541
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/ServiceJobProcessesMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class ServiceJobProcessesMixin { @JsonCreator public ServiceJobProcessesMixin(@JsonProperty("disableIncreaseDesired") boolean disableIncreaseDesired, @JsonProperty("disableDecreaseDesired") boolean disableDecreaseDesired) { } }
9,542
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/SharedContainerVolumeSourceMixin.java
package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class SharedContainerVolumeSourceMixin { @JsonCreator public SharedContainerVolumeSourceMixin( @JsonProperty("sourceContainer") String sourceContainer, @JsonProperty("sourcePath") String sourcePath ) { } }
9,543
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/DelayedRetryPolicyMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class DelayedRetryPolicyMixin { @JsonCreator public DelayedRetryPolicyMixin(@JsonProperty("delayMs") long delayMs, @JsonProperty("retries") int retries) { } }
9,544
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/HourlyTimeWindowMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class HourlyTimeWindowMixIn { @JsonCreator protected HourlyTimeWindowMixIn(@JsonProperty("startHour") int startHour, @JsonProperty("endHour") int endHour) { } }
9,545
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/TaskInstancesMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class TaskInstancesMixin { @JsonCreator public TaskInstancesMixin(@JsonProperty("min") int min, @JsonProperty("desired") int desired, @JsonProperty("max") int max) { } }
9,546
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/OwnerMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class OwnerMixin { @JsonCreator public OwnerMixin(@JsonProperty("teamEmail") String teamEmail) { } }
9,547
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/SelfManagedDisruptionBudgetPolicyMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class SelfManagedDisruptionBudgetPolicyMixIn { @JsonCreator public SelfManagedDisruptionBudgetPolicyMixIn(@JsonProperty("relocationTimeMs") long relocationTimeMs) { } }
9,548
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/BatchJobExtMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.retry.RetryPolicy; public abstract class BatchJobExtMixin { @JsonCreator BatchJobExtMixin(@JsonProperty("size") int size, @JsonProperty("runtimeLimitMs") long runtimeLimitMs, @JsonProperty("retryPolicy") RetryPolicy retryPolicy, @JsonProperty("retryOnRuntimeLimit") boolean retryOnRuntimeLimit) { } }
9,549
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/RatePerIntervalDisruptionBudgetRateMixIn.java
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class RatePerIntervalDisruptionBudgetRateMixIn { @JsonCreator public RatePerIntervalDisruptionBudgetRateMixIn(@JsonProperty("intervalMs") long intervalMs, @JsonProperty("limitPerInterval") int limitPerInterval) { } }
9,550
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/TaskMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.netflix.titus.api.jobmanager.model.job.BatchJobTask; import com.netflix.titus.api.jobmanager.model.job.ServiceJobTask; @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = BatchJobTask.class, name = "batchJobTask"), @JsonSubTypes.Type(value = ServiceJobTask.class, name = "serviceJobTask") }) public abstract class TaskMixin { }
9,551
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/SelfManagedMigrationPolicyMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; public abstract class SelfManagedMigrationPolicyMixin { @JsonCreator public SelfManagedMigrationPolicyMixin() { } }
9,552
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/ContainerHealthProviderMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.Map; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class ContainerHealthProviderMixIn { @JsonCreator public ContainerHealthProviderMixIn(@JsonProperty("name") String name, @JsonProperty("attributes") Map<String, String> attributes) { } }
9,553
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/MigrationDetailsMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class MigrationDetailsMixin { @JsonCreator protected MigrationDetailsMixin(@JsonProperty("needsMigration") boolean needsMigration, @JsonProperty("started") long started, @JsonProperty("deadline") long deadline) { } }
9,554
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/IpAddressAllocationMixin.java
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.vpc.IpAddressLocation; public abstract class IpAddressAllocationMixin { @JsonCreator public IpAddressAllocationMixin(@JsonProperty("ipAddressLocation") IpAddressLocation ipAddressLocation, @JsonProperty("allocationId") String allocationId, @JsonProperty("ipAddress") String ipAddress) { } }
9,555
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/RetryPolicyMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.netflix.titus.api.jobmanager.model.job.retry.DelayedRetryPolicy; import com.netflix.titus.api.jobmanager.model.job.retry.ExponentialBackoffRetryPolicy; import com.netflix.titus.api.jobmanager.model.job.retry.ImmediateRetryPolicy; @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = ImmediateRetryPolicy.class, name = "immediateRetryPolicy"), @JsonSubTypes.Type(value = DelayedRetryPolicy.class, name = "delayedRetryPolicy"), @JsonSubTypes.Type(value = ExponentialBackoffRetryPolicy.class, name = "exponentialBackoffRetryPolicy"), }) public abstract class RetryPolicyMixin { }
9,556
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/NetworkConfigurationMixin.java
package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class NetworkConfigurationMixin { @JsonCreator public NetworkConfigurationMixin( @JsonProperty("networkMode") int networkMode) { } }
9,557
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/VolumeSourceMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.netflix.titus.api.jobmanager.model.job.volume.SaaSVolumeSource; import com.netflix.titus.api.jobmanager.model.job.volume.SharedContainerVolumeSource; @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = SaaSVolumeSource.class, name = "saaSVolumeSource"), @JsonSubTypes.Type(value = SharedContainerVolumeSource.class, name = "sharedContainerVolumeSource"), }) public abstract class VolumeSourceMixin { }
9,558
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/TwoLevelResourceMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class TwoLevelResourceMixIn { @JsonCreator protected TwoLevelResourceMixIn(@JsonProperty("name") String name, @JsonProperty("value") String value, @JsonProperty("index") int index) { } }
9,559
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/JobStatusMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.JobState; public abstract class JobStatusMixin { @JsonCreator public JobStatusMixin(@JsonProperty("jobState") JobState jobState, @JsonProperty("reasonCode") String reasonCode, @JsonProperty("reasonMessage") String reasonMessage, @JsonProperty("timestamp") long timestamp) { } }
9,560
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/JobDescriptorMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.BasicContainer; import com.netflix.titus.api.jobmanager.model.job.Container; import com.netflix.titus.api.jobmanager.model.job.JobDescriptor; import com.netflix.titus.api.jobmanager.model.job.JobGroupInfo; import com.netflix.titus.api.jobmanager.model.job.NetworkConfiguration; import com.netflix.titus.api.jobmanager.model.job.Owner; import com.netflix.titus.api.jobmanager.model.job.PlatformSidecar; import com.netflix.titus.api.jobmanager.model.job.volume.Volume; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.DisruptionBudget; public abstract class JobDescriptorMixin { @JsonCreator public JobDescriptorMixin(@JsonProperty("owner") Owner owner, @JsonProperty("applicationName") String applicationName, @JsonProperty("capacityGroup") String capacityGroup, @JsonProperty("jobGroupInfo") JobGroupInfo jobGroupInfo, @JsonProperty("labels") Map<String, String> labels, @JsonProperty("container") Container container, @JsonProperty("disruptionBudget") DisruptionBudget disruptionBudget, @JsonProperty("networkConfiguration") NetworkConfiguration networkConfiguration, @JsonProperty("extraContainers") List<BasicContainer> extraContainers, @JsonProperty("volumes") List<Volume> volumes, @JsonProperty("platformSidecars") List<PlatformSidecar> platformSidecars, @JsonProperty("extensions") JobDescriptor.JobDescriptorExt extensions) { } }
9,561
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/JobGroupInfoMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class JobGroupInfoMixin { @JsonCreator public JobGroupInfoMixin(@JsonProperty("stack") String stack, @JsonProperty("detail") String detail, @JsonProperty("sequence") String sequence) { } }
9,562
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/ContainerResourcesMixin.java
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.List; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.ebs.EbsVolume; import com.netflix.titus.api.jobmanager.model.job.vpc.SignedIpAddressAllocation; import com.netflix.titus.api.model.EfsMount; @JsonIgnoreProperties(ignoreUnknown = true) public abstract class ContainerResourcesMixin { @JsonCreator public ContainerResourcesMixin(@JsonProperty("cpu") double cpu, @JsonProperty("gpu") int gpu, @JsonProperty("memoryMB") int memoryMB, @JsonProperty("diskMB") int diskMB, @JsonProperty("networkMbps") int networkMbps, @JsonProperty("efsMounts") List<EfsMount> efsMounts, @JsonProperty("allocateIP") boolean allocateIP, @JsonProperty("shmMB") int shmMB, @JsonProperty("signedIpAddressAllocations") List<SignedIpAddressAllocation> signedIpAddressAllocations, @JsonProperty("ebsVolumes") List<EbsVolume> ebsVolumes) { } }
9,563
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/SecurityProfileMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class SecurityProfileMixin { @JsonCreator public SecurityProfileMixin(@JsonProperty("securityGroups") List<String> securityGroups, @JsonProperty("iamRole") String iamRole, @JsonProperty("attributes") Map<String, String> attributes) { } }
9,564
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/EbsVolumeMixIn.java
/* * Copyright 2020 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.ebs.EbsVolume; @JsonIgnoreProperties(ignoreUnknown = true) public abstract class EbsVolumeMixIn { @JsonCreator public EbsVolumeMixIn(@JsonProperty("volumeId") String volumeId, @JsonProperty("volumeAvailabilityZone") String volumeAvailabilityZone, @JsonProperty("volumeCapacityGB") int volumeCapacityGB, @JsonProperty("mountPath") String mountPath, @JsonProperty("mountPermissions")EbsVolume.MountPerm mountPermissions, @JsonProperty("fsType") String fsType) { } }
9,565
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/AvailabilityPercentageLimitDisruptionBudgetPolicyMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class AvailabilityPercentageLimitDisruptionBudgetPolicyMixIn { @JsonCreator public AvailabilityPercentageLimitDisruptionBudgetPolicyMixIn( @JsonProperty("percentageOfHealthyContainers") double percentageOfHealthyContainers) { } }
9,566
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/ImageMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class ImageMixin { @JsonCreator public ImageMixin(@JsonProperty("name") String name, @JsonProperty("tag") String tag, @JsonProperty("digest") String digest) { } }
9,567
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/VersionMixin.java
/* * Copyright 2021 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class VersionMixin { @JsonCreator public VersionMixin(@JsonProperty("timestamp") long timestamp) { } }
9,568
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/ScalingPolicyMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.Map; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class ScalingPolicyMixin { @JsonCreator protected ScalingPolicyMixin(@JsonProperty("condition") String condition, @JsonProperty("action") String action, @JsonProperty("durationSecs") long durationSecs, @JsonProperty("attributes") Map<String, String> attributes) { } }
9,569
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/ServiceJobTaskMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.List; import java.util.Map; import java.util.Optional; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.TaskStatus; import com.netflix.titus.api.jobmanager.model.job.TwoLevelResource; import com.netflix.titus.api.jobmanager.model.job.Version; import com.netflix.titus.api.jobmanager.model.job.migration.MigrationDetails; public class ServiceJobTaskMixin { @JsonCreator protected ServiceJobTaskMixin(@JsonProperty("id") String id, @JsonProperty("originalId") String originalId, @JsonProperty("resubmitOf") Optional<String> resubmitOf, @JsonProperty("jobId") String jobId, @JsonProperty("resubmitNumber") int resubmitNumber, @JsonProperty("systemResubmitNumber") int systemResubmitNumber, @JsonProperty("evictionResubmitNumber") int evictionResubmitNumber, @JsonProperty("status") TaskStatus status, @JsonProperty("statusHistory") List<TaskStatus> statusHistory, @JsonProperty("twoLevelResources") List<TwoLevelResource> twoLevelResources, @JsonProperty("taskContext") Map<String, String> taskContext, @JsonProperty("attributes") Map<String, String> attributes, @JsonProperty("migrationDetails") MigrationDetails migrationDetails, @JsonProperty("version") Version version) { } }
9,570
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/TimeWindowMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.List; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.Day; import com.netflix.titus.api.jobmanager.model.job.disruptionbudget.HourlyTimeWindow; public abstract class TimeWindowMixIn { @JsonCreator protected TimeWindowMixIn(@JsonProperty("days") List<Day> days, @JsonProperty("hourlyTimeWindows") List<HourlyTimeWindow> hourlyTimeWindows, @JsonProperty("timeZone") String timeZone) { } }
9,571
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/UnlimitedDisruptionBudgetRateMixIn.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; public class UnlimitedDisruptionBudgetRateMixIn { @JsonCreator public UnlimitedDisruptionBudgetRateMixIn() { } }
9,572
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/IpAddressLocationMixin.java
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class IpAddressLocationMixin { @JsonCreator public IpAddressLocationMixin(@JsonProperty("region") String region, @JsonProperty("availabilityZone") String availabilityZone, @JsonProperty("subnetId") String subnetId) { } }
9,573
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/ContainerMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.netflix.titus.api.jobmanager.model.job.ContainerResources; import com.netflix.titus.api.jobmanager.model.job.Image; import com.netflix.titus.api.jobmanager.model.job.SecurityProfile; import com.netflix.titus.api.jobmanager.model.job.VolumeMount; public abstract class ContainerMixin { @JsonCreator public ContainerMixin(@JsonProperty("containerResources") ContainerResources containerResources, @JsonProperty("securityProfile") SecurityProfile securityProfile, @JsonProperty("image") Image image, @JsonProperty("attributes") Map<String, String> attributes, @JsonProperty("entryPoint") List<String> entryPoint, @JsonProperty("command") List<String> command, @JsonProperty("env") Map<String, String> env, @JsonProperty("softConstraints") Map<String, String> softConstraints, @JsonProperty("hardConstraints") Map<String, String> hardConstraints, @JsonSetter(nulls = Nulls.AS_EMPTY) @JsonProperty("volumeMounts") List<VolumeMount> volumeMounts ) { } }
9,574
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/JobDescriptorExtMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.netflix.titus.api.jobmanager.model.job.ext.BatchJobExt; import com.netflix.titus.api.jobmanager.model.job.ext.ServiceJobExt; @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = BatchJobExt.class, name = "batchJobExt"), @JsonSubTypes.Type(value = ServiceJobExt.class, name = "serviceJobExt") }) public class JobDescriptorExtMixin { }
9,575
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/jobmanager/store/mixin/ExponentialBackoffRetryPolicyMixin.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.jobmanager.store.mixin; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; public class ExponentialBackoffRetryPolicyMixin { @JsonCreator public ExponentialBackoffRetryPolicyMixin(@JsonProperty("retries") int retries, @JsonProperty("initialDelayMs") long initialDelayMs, @JsonProperty("maxDelayMs") long maxDelayMs) { } }
9,576
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth/model/ContainerHealthStatus.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.containerhealth.model; import java.util.Objects; import com.google.common.base.Preconditions; /** * {@link ContainerHealthStatus} represents an application health status in a point in time. */ public class ContainerHealthStatus { private final String taskId; private final ContainerHealthState state; private final String reason; private final long timestamp; public ContainerHealthStatus(String taskId, ContainerHealthState state, String reason, long timestamp) { this.taskId = taskId; this.state = state; this.reason = reason; this.timestamp = timestamp; } public String getTaskId() { return taskId; } public ContainerHealthState getState() { return state; } public long getTimestamp() { return timestamp; } public String getReason() { return reason; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ContainerHealthStatus that = (ContainerHealthStatus) o; return timestamp == that.timestamp && Objects.equals(taskId, that.taskId) && state == that.state && Objects.equals(reason, that.reason); } @Override public int hashCode() { return Objects.hash(taskId, state, reason, timestamp); } @Override public String toString() { return "ContainerHealthStatus{" + "taskId='" + taskId + '\'' + ", state=" + state + ", reason='" + reason + '\'' + ", timestamp=" + timestamp + '}'; } public static ContainerHealthStatus healthy(String taskId, long timestamp) { return newStatus(taskId, timestamp, "healthy", ContainerHealthState.Healthy); } public static ContainerHealthStatus unhealthy(String taskId, String reason, long timestamp) { return newStatus(taskId, timestamp, reason, ContainerHealthState.Unhealthy); } public static ContainerHealthStatus unknown(String taskId, String reason, long timestamp) { return newStatus(taskId, timestamp, reason, ContainerHealthState.Unhealthy); } public static ContainerHealthStatus terminated(String taskId, long timestamp) { return newStatus(taskId, timestamp, "terminated", ContainerHealthState.Terminated); } private static ContainerHealthStatus newStatus(String taskId, long timestamp, String reason, ContainerHealthState state) { return ContainerHealthStatus.newBuilder() .withTaskId(taskId) .withTimestamp(timestamp) .withState(state) .withReason(reason) .build(); } public static Builder newBuilder() { return new Builder(); } public static final class Builder { private String taskId; private ContainerHealthState state; private String reason; private long timestamp; private Builder() { } public Builder withTaskId(String taskId) { this.taskId = taskId; return this; } public Builder withState(ContainerHealthState state) { this.state = state; return this; } public Builder withReason(String reason) { this.reason = reason; return this; } public Builder withTimestamp(long timestamp) { this.timestamp = timestamp; return this; } public Builder but() { return newBuilder().withTaskId(taskId).withState(state).withReason(reason).withTimestamp(timestamp); } public ContainerHealthStatus build() { Preconditions.checkNotNull(taskId, "Task id not set"); Preconditions.checkNotNull(state, "Container health state not set"); Preconditions.checkNotNull(reason, "Container health reason not set"); return new ContainerHealthStatus(taskId, state, reason, timestamp); } } }
9,577
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth/model/ContainerHealthState.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.containerhealth.model; public enum ContainerHealthState { /** * The application process running in the container is healthy, and ready to handle user requests. */ Healthy, /** * The application process running in the container is not running or in broken state. * It is not ready to handle user requests. In the job disruption budget, it should be counted as not available. */ Unhealthy, /** * The health status of the application running in the container is not known. */ Unknown, /** * The application/container are terminated. All tasks which are finished are assigned this state. */ Terminated }
9,578
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth/model/ContainerHealthFunctions.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.containerhealth.model; import com.google.common.base.Preconditions; /** * Collection of functions to manipulate container health data.ł */ public final class ContainerHealthFunctions { public static ContainerHealthStatus merge(ContainerHealthStatus first, ContainerHealthStatus second) { Preconditions.checkArgument(first.getTaskId().equals(second.getTaskId()), "Cannot merge health status of two different tasks"); ContainerHealthState effectiveState; switch (first.getState()) { case Healthy: effectiveState = second.getState(); break; case Unhealthy: effectiveState = ContainerHealthState.Unhealthy; break; case Unknown: effectiveState = second.getState() == ContainerHealthState.Unhealthy ? ContainerHealthState.Unhealthy : ContainerHealthState.Unknown; break; case Terminated: effectiveState = second.getState(); break; default: effectiveState = ContainerHealthState.Unknown; } String reason; if (first.getState() == ContainerHealthState.Healthy) { reason = second.getReason(); } else if (second.getState() == ContainerHealthState.Healthy) { reason = first.getReason(); } else { reason = first.getReason() + ", " + second.getReason(); } return ContainerHealthStatus.newBuilder() .withTaskId(first.getTaskId()) .withState(effectiveState) .withReason(reason) .withTimestamp(Math.max(first.getTimestamp(), second.getTimestamp())) .build(); } }
9,579
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth/model
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth/model/event/ContainerHealthEvent.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.containerhealth.model.event; import java.util.List; import com.netflix.titus.api.containerhealth.model.ContainerHealthStatus; public abstract class ContainerHealthEvent { public static ContainerHealthUpdateEvent healthChanged(ContainerHealthStatus status) { return new ContainerHealthUpdateEvent(status); } public static ContainerHealthSnapshotEvent snapshot(List<ContainerHealthStatus> statuses) { return new ContainerHealthSnapshotEvent(statuses); } }
9,580
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth/model
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth/model/event/ContainerHealthUpdateEvent.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.containerhealth.model.event; import java.util.Objects; import com.netflix.titus.api.containerhealth.model.ContainerHealthStatus; public class ContainerHealthUpdateEvent extends ContainerHealthEvent { private final ContainerHealthStatus containerHealthStatus; public ContainerHealthUpdateEvent(ContainerHealthStatus containerHealthStatus) { this.containerHealthStatus = containerHealthStatus; } public ContainerHealthStatus getContainerHealthStatus() { return containerHealthStatus; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ContainerHealthUpdateEvent that = (ContainerHealthUpdateEvent) o; return Objects.equals(containerHealthStatus, that.containerHealthStatus); } @Override public int hashCode() { return Objects.hash(containerHealthStatus); } @Override public String toString() { return "ContainerHealthChangeEvent{" + "containerHealthStatus=" + containerHealthStatus + '}'; } }
9,581
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth/model
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth/model/event/ContainerHealthSnapshotEvent.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.containerhealth.model.event; import java.util.List; import java.util.Objects; import com.netflix.titus.api.containerhealth.model.ContainerHealthStatus; public class ContainerHealthSnapshotEvent extends ContainerHealthEvent { private final List<ContainerHealthStatus> snapshot; public ContainerHealthSnapshotEvent(List<ContainerHealthStatus> snapshot) { this.snapshot = snapshot; } public List<ContainerHealthStatus> getSnapshot() { return snapshot; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ContainerHealthSnapshotEvent that = (ContainerHealthSnapshotEvent) o; return Objects.equals(snapshot, that.snapshot); } @Override public int hashCode() { return Objects.hash(snapshot); } @Override public String toString() { return "ContainerHealthSnapshotEvent{" + "snapshot=" + snapshot + '}'; } }
9,582
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/containerhealth/service/ContainerHealthService.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.containerhealth.service; import java.util.Optional; import com.netflix.titus.api.containerhealth.model.ContainerHealthStatus; import com.netflix.titus.api.containerhealth.model.event.ContainerHealthEvent; import com.netflix.titus.api.jobmanager.model.job.TaskState; import com.netflix.titus.api.jobmanager.service.JobManagerException; import reactor.core.publisher.Flux; /** * This service provides information about the application level health status of a process running in a container. */ public interface ContainerHealthService { /** * Container health provider name. */ String getName(); default ContainerHealthStatus getHealthStatus(String taskId) { return findHealthStatus(taskId).orElseThrow(() -> JobManagerException.taskNotFound(taskId)); } /** * Returns task's status, if the task with the given id is known or {@link Optional#empty()} otherwise. * If a task is in the {@link TaskState#Finished} state, its status will be returned as long as it is kept * in memory (its job is active, and it is not archived yet). */ Optional<ContainerHealthStatus> findHealthStatus(String taskId); /** * Event stream which emits container health change notifications. * * @param snapshot if set to true, all known health states are emitted first, followed by the snapshot marker. */ Flux<ContainerHealthEvent> events(boolean snapshot); }
9,583
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/JobLoadBalancer.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.model; import javax.validation.constraints.Size; /** * Association between a Job and a LoadBalancer */ public class JobLoadBalancer implements Comparable<JobLoadBalancer> { public enum State {ASSOCIATED, DISSOCIATED} @Size(min = 1, max = 50) private final String jobId; @Size(min = 1, max = 1024) private final String loadBalancerId; public JobLoadBalancer(String jobId, String loadBalancerId) { this.jobId = jobId; this.loadBalancerId = loadBalancerId; } public String getJobId() { return jobId; } public String getLoadBalancerId() { return loadBalancerId; } @Override public String toString() { return "JobLoadBalancer{" + "jobId='" + jobId + '\'' + ", loadBalancerId='" + loadBalancerId + '\'' + '}'; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } JobLoadBalancer that = (JobLoadBalancer) o; if (!jobId.equals(that.jobId)) { return false; } return loadBalancerId.equals(that.loadBalancerId); } @Override public int hashCode() { int result = jobId.hashCode(); result = 31 * result + loadBalancerId.hashCode(); return result; } @Override public int compareTo(JobLoadBalancer o) { if (!jobId.equals(o.getJobId())) { return jobId.compareTo(o.getJobId()); } return loadBalancerId.compareTo(o.getLoadBalancerId()); } /** * {@link java.util.function.BiPredicate} that compares <tt>loadBalancerIds</tt>. */ public static boolean byLoadBalancerId(JobLoadBalancer one, JobLoadBalancer other) { return one.loadBalancerId.equals(other.loadBalancerId); } }
9,584
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/JobLoadBalancerState.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.model; import java.util.Map; import java.util.Objects; import com.netflix.titus.common.util.tuple.Pair; public class JobLoadBalancerState { private final JobLoadBalancer jobLoadBalancer; private final JobLoadBalancer.State state; public JobLoadBalancerState(JobLoadBalancer jobLoadBalancer, JobLoadBalancer.State state) { this.jobLoadBalancer = jobLoadBalancer; this.state = state; } public JobLoadBalancer getJobLoadBalancer() { return jobLoadBalancer; } public JobLoadBalancer.State getState() { return state; } public String getJobId() { return jobLoadBalancer.getJobId(); } public String getLoadBalancerId() { return jobLoadBalancer.getLoadBalancerId(); } public boolean isStateAssociated() { return JobLoadBalancer.State.ASSOCIATED.equals(state); } public boolean isStateDissociated() { return JobLoadBalancer.State.DISSOCIATED.equals(state); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof JobLoadBalancerState)) { return false; } JobLoadBalancerState that = (JobLoadBalancerState) o; return Objects.equals(jobLoadBalancer, that.jobLoadBalancer) && state == that.state; } @Override public int hashCode() { return Objects.hash(jobLoadBalancer, state); } @Override public String toString() { return "JobLoadBalancerState{" + "jobLoadBalancer=" + jobLoadBalancer + ", state=" + state + '}'; } public static JobLoadBalancerState from(Map.Entry<JobLoadBalancer, JobLoadBalancer.State> entry) { return new JobLoadBalancerState(entry.getKey(), entry.getValue()); } public static JobLoadBalancerState from(Pair<JobLoadBalancer, JobLoadBalancer.State> entry) { return new JobLoadBalancerState(entry.getLeft(), entry.getRight()); } }
9,585
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/LoadBalancerTargetState.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.model; import java.util.Map; public class LoadBalancerTargetState { private final LoadBalancerTarget loadBalancerTarget; private final LoadBalancerTarget.State state; public LoadBalancerTargetState(LoadBalancerTarget loadBalancerTarget, LoadBalancerTarget.State state) { this.loadBalancerTarget = loadBalancerTarget; this.state = state; } public LoadBalancerTarget getLoadBalancerTarget() { return loadBalancerTarget; } public LoadBalancerTarget.State getState() { return state; } public String getIpAddress() { return loadBalancerTarget.getIpAddress(); } @Override public String toString() { return "TargetState{" + "loadBalancerTarget=" + loadBalancerTarget + ", state=" + state + '}'; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } LoadBalancerTargetState that = (LoadBalancerTargetState) o; if (!loadBalancerTarget.equals(that.loadBalancerTarget)) { return false; } return state == that.state; } @Override public int hashCode() { int result = loadBalancerTarget.hashCode(); result = 31 * result + state.hashCode(); return result; } public static LoadBalancerTargetState from(Map.Entry<LoadBalancerTarget, LoadBalancerTarget.State> entry) { return new LoadBalancerTargetState(entry.getKey(), entry.getValue()); } }
9,586
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/LoadBalancerTarget.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.model; import java.util.Objects; import javax.validation.constraints.Size; public class LoadBalancerTarget { public enum State {REGISTERED, DEREGISTERED} @Size(min = 1, max = 1024) private final String loadBalancerId; private final String ipAddress; /** * taskId is a descriptive field only, it is not part of the identity of this object */ private final String taskId; public LoadBalancerTarget(String loadBalancerId, String taskId, String ipAddress) { this.loadBalancerId = loadBalancerId; this.ipAddress = ipAddress; this.taskId = taskId; } public String getLoadBalancerId() { return loadBalancerId; } public String getTaskId() { return taskId; } public String getIpAddress() { return ipAddress; } public LoadBalancerTargetState withState(State state) { return new LoadBalancerTargetState(this, state); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } LoadBalancerTarget that = (LoadBalancerTarget) o; return loadBalancerId.equals(that.loadBalancerId) && ipAddress.equals(that.ipAddress); } @Override public int hashCode() { return Objects.hash(loadBalancerId, ipAddress); } @Override public String toString() { return "LoadBalancerTarget{" + "loadBalancerId='" + loadBalancerId + '\'' + ", ipAddress='" + ipAddress + '\'' + ", taskId='" + taskId + '\'' + '}'; } }
9,587
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/package-info.java
/* * Copyright 2020 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ @NonNullApi @NonNullFields package com.netflix.titus.api.loadbalancer.model; import org.springframework.lang.NonNullApi; import org.springframework.lang.NonNullFields;
9,588
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/sanitizer/DefaultLoadBalancerResourceValidator.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.model.sanitizer; import javax.inject.Inject; import javax.inject.Singleton; import com.netflix.titus.api.connector.cloud.LoadBalancerConnector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import rx.Completable; @Singleton public class DefaultLoadBalancerResourceValidator implements LoadBalancerResourceValidator { private static final Logger logger = LoggerFactory.getLogger(DefaultLoadBalancerJobValidator.class); private final LoadBalancerConnector loadBalancerConnector; @Inject public DefaultLoadBalancerResourceValidator(LoadBalancerConnector connector) { this.loadBalancerConnector = connector; } @Override public Completable validateLoadBalancer(String loadBalancerId) { // We depend on the load balancer implementation-specific connector to indicate // what makes a load balancer ID valid or not. return loadBalancerConnector.isValid(loadBalancerId); } }
9,589
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/sanitizer/LoadBalancerSanitizerBuilder.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.model.sanitizer; import com.netflix.titus.common.model.sanitizer.EntitySanitizer; import com.netflix.titus.common.model.sanitizer.EntitySanitizerBuilder; public class LoadBalancerSanitizerBuilder { public static final String LOAD_BALANCER_SANITIZER = "loadbalancer"; private final EntitySanitizerBuilder sanitizerBuilder = EntitySanitizerBuilder.stdBuilder(); public EntitySanitizer build() { return sanitizerBuilder.build(); } }
9,590
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/sanitizer/LoadBalancerJobValidator.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.model.sanitizer; import com.netflix.titus.api.jobmanager.service.JobManagerException; import com.netflix.titus.api.loadbalancer.service.LoadBalancerException; public interface LoadBalancerJobValidator { /** * Validates that a Job ID is capable of having a load balancer associated with it. * * @param jobId * @throws Exception */ void validateJobId(String jobId) throws LoadBalancerException, JobManagerException; }
9,591
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/sanitizer/DefaultLoadBalancerJobValidator.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.model.sanitizer; import javax.inject.Inject; import javax.inject.Singleton; import com.netflix.titus.api.jobmanager.model.job.ContainerResources; import com.netflix.titus.api.jobmanager.model.job.Job; import com.netflix.titus.api.jobmanager.model.job.JobDescriptor; import com.netflix.titus.api.jobmanager.model.job.JobState; import com.netflix.titus.api.jobmanager.model.job.ext.ServiceJobExt; import com.netflix.titus.api.jobmanager.service.JobManagerException; import com.netflix.titus.api.jobmanager.service.V3JobOperations; import com.netflix.titus.api.loadbalancer.service.LoadBalancerException; import com.netflix.titus.api.loadbalancer.store.LoadBalancerStore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Singleton public class DefaultLoadBalancerJobValidator implements LoadBalancerJobValidator { private static final Logger logger = LoggerFactory.getLogger(DefaultLoadBalancerJobValidator.class); private final V3JobOperations v3JobOperations; private final LoadBalancerStore loadBalancerStore; private final LoadBalancerValidationConfiguration loadBalancerValidationConfiguration; @Inject public DefaultLoadBalancerJobValidator(V3JobOperations v3JobOperations, LoadBalancerStore loadBalancerStore, LoadBalancerValidationConfiguration loadBalancerValidationConfiguration) { this.v3JobOperations = v3JobOperations; this.loadBalancerStore = loadBalancerStore; this.loadBalancerValidationConfiguration = loadBalancerValidationConfiguration; } @Override public void validateJobId(String jobId) throws LoadBalancerException, JobManagerException { // Job must exist Job job = v3JobOperations.getJob(jobId).orElseThrow(() -> JobManagerException.v3JobNotFound(jobId)); // Job must be active JobState state = job.getStatus().getState(); if (state != JobState.Accepted) { throw JobManagerException.unexpectedJobState(job, JobState.Accepted); } // Must be a service job JobDescriptor.JobDescriptorExt extensions = job.getJobDescriptor().getExtensions(); if (!(extensions instanceof ServiceJobExt)) { throw JobManagerException.notServiceJob(jobId); } // Job should have less than max current load balancer associations int maxLoadBalancers = loadBalancerValidationConfiguration.getMaxLoadBalancersPerJob(); int numLoadBalancers = loadBalancerStore.getNumLoadBalancersForJob(jobId); if (numLoadBalancers > maxLoadBalancers) { throw LoadBalancerException.jobMaxLoadBalancers(jobId, numLoadBalancers, maxLoadBalancers); } } }
9,592
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/sanitizer/LoadBalancerResourceValidator.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.model.sanitizer; import rx.Completable; public interface LoadBalancerResourceValidator { /** * Validates that a load balancer can be associated with a Job. * * @param loadBalancerId * @return */ Completable validateLoadBalancer(String loadBalancerId); }
9,593
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/sanitizer/LoadBalancerValidationConfiguration.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.model.sanitizer; import com.netflix.archaius.api.annotations.Configuration; import com.netflix.archaius.api.annotations.DefaultValue; @Configuration(prefix = "titus.master.loadBalancer") public interface LoadBalancerValidationConfiguration { @DefaultValue("30") int getMaxLoadBalancersPerJob(); }
9,594
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/model/sanitizer/NoOpLoadBalancerJobValidator.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.model.sanitizer; import com.netflix.titus.api.jobmanager.service.JobManagerException; import com.netflix.titus.api.loadbalancer.service.LoadBalancerException; public class NoOpLoadBalancerJobValidator implements LoadBalancerJobValidator { @Override public void validateJobId(String jobId) throws LoadBalancerException, JobManagerException { } }
9,595
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/service/LoadBalancerService.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.service; import java.util.List; import com.netflix.titus.api.loadbalancer.model.JobLoadBalancer; import com.netflix.titus.api.model.Page; import com.netflix.titus.api.model.Pagination; import com.netflix.titus.common.util.tuple.Pair; import rx.Completable; import rx.Observable; public interface LoadBalancerService { /** * Returns all load balancers associated to a specific job. * * @param jobId * @return */ Observable<String> getJobLoadBalancers(String jobId); /** * Blocking call that returns all job/load balancer associations. * As a blocking call, data must be served from cached/in-memory data and avoid doing external calls. * * @return */ Pair<List<JobLoadBalancer>, Pagination> getAllLoadBalancers(Page page); /** * Adds a load balancer to an existing job. * * @param jobId * @param loadBalancerId * @return */ Completable addLoadBalancer(String jobId, String loadBalancerId); /** * Removes a load balancer from an existing job. * * @param jobId * @param loadBalancerId * @return */ Completable removeLoadBalancer(String jobId, String loadBalancerId); }
9,596
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/service/LoadBalancerException.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.service; import org.slf4j.event.Level; import static java.lang.String.format; public class LoadBalancerException extends RuntimeException { public enum ErrorCode { JobMaxLoadBalancers } private final ErrorCode errorCode; private LoadBalancerException(Builder builder) { super(builder.message, builder.cause); this.errorCode = builder.errorCode; } public ErrorCode getErrorCode() { return errorCode; } public static LoadBalancerException jobMaxLoadBalancers(String jobId, int maxLoadBalancers, int curLoadBalancers) { return new Builder( ErrorCode.JobMaxLoadBalancers, format( "Job %s already has %d load balancers and maximum is %s", jobId, curLoadBalancers, maxLoadBalancers)) .build(); } public static final class Builder { private final ErrorCode errorCode; private final String message; private Throwable cause; private Builder(ErrorCode errorCode, String message) { this.errorCode = errorCode; this.message = message; } public Builder withCause(Throwable cause) { this.cause = cause; return this; } public LoadBalancerException build() { return new LoadBalancerException(this); } } }
9,597
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/store/LoadBalancerStore.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.store; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Set; import com.netflix.titus.api.loadbalancer.model.JobLoadBalancer; import com.netflix.titus.api.loadbalancer.model.JobLoadBalancerState; import com.netflix.titus.api.loadbalancer.model.LoadBalancerTarget; import com.netflix.titus.api.loadbalancer.model.LoadBalancerTargetState; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import rx.Completable; import rx.Observable; public interface LoadBalancerStore { /** * Returns an observable stream of load balancers in associated state for a Job. */ Observable<JobLoadBalancer> getAssociatedLoadBalancersForJob(String jobId); /** * Adds a new or updates an existing load balancer with the provided state. */ Completable addOrUpdateLoadBalancer(JobLoadBalancer jobLoadBalancer, JobLoadBalancer.State state); /** * Removes a load balancer associated with a job. */ Completable removeLoadBalancer(JobLoadBalancer jobLoadBalancer); /** * Blocking call that returns the current snapshot set of load balancers associated with for a Job. * As a blocking call, data must be served from cached/in-memory data and avoid doing external calls. */ Set<JobLoadBalancer> getAssociatedLoadBalancersSetForJob(String jobId); /** * Blocking call that returns the number of load balancers associated with a job. * As a blocking call, data must be served from cached/in-memory data and avoid doing external calls. * * @return Returns 0 even if jobId does not exist. */ int getNumLoadBalancersForJob(String jobId); /** * Blocking call that returns a (snapshot) view of the existing job/loadBalancer associations. It must work out of * cached data in-memory only, and avoid doing external calls. */ List<JobLoadBalancerState> getAssociations(); /** * Blocking call that returns the current snapshot page of the given offset/size of times all load balancers. As a * blocking call, data must be served from cached/in-memory data and avoid doing external calls. */ List<JobLoadBalancer> getAssociationsPage(int offset, int limit); /** * Adds or updates targets with the provided states. */ Mono<Void> addOrUpdateTargets(Collection<LoadBalancerTargetState> targets); /** * Adds or updates targets with the provided states. */ default Mono<Void> addOrUpdateTargets(LoadBalancerTargetState... targetStates) { return addOrUpdateTargets(Arrays.asList(targetStates)); } /** * Removes deregistered targets associated with a load balancer. Targets that currently do not have their state as * {@link LoadBalancerTarget.State#DEREGISTERED} in the store are ignored. The state check must be atomic within * the whole <tt>DELETE</tt> operation, so this method can be used for optimistic concurrency control. */ Mono<Void> removeDeregisteredTargets(Collection<LoadBalancerTarget> targets); /** * Known (seen before) targets for a particular load balancer */ Flux<LoadBalancerTargetState> getLoadBalancerTargets(String loadBalancerId); }
9,598
0
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer
Create_ds/titus-control-plane/titus-api/src/main/java/com/netflix/titus/api/loadbalancer/store/LoadBalancerStoreException.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.api.loadbalancer.store; import java.util.Set; import com.netflix.titus.common.model.sanitizer.ValidationError; public class LoadBalancerStoreException extends RuntimeException { public enum ErrorCode { BAD_DATA, CASSANDRA_DRIVER_ERROR, } private final ErrorCode errorCode; private LoadBalancerStoreException(String message, ErrorCode errorCode) { this(message, errorCode, null); } private LoadBalancerStoreException(String message, ErrorCode errorCode, Throwable cause) { super(message, cause); this.errorCode = errorCode; } public ErrorCode getErrorCode() { return errorCode; } public static <T> LoadBalancerStoreException badData(T value, Set<ValidationError> violations) { return new LoadBalancerStoreException( String.format("Entity %s violates constraints: %s", value, violations), ErrorCode.BAD_DATA); } }
9,599