@VisibleForTesting int getPartition(ScheduleId scheduleId) { // Similar to ScheduleId#hashCode, but that is not consistent across runtimes due to how Enum#hashCode works. // Ensure that the hash won't change across runtimes: int hash = Hashing.murmur3_32().newHasher() .putString(scheduleId.getNamespace()) .putString(scheduleId.getApplication()) .putString(scheduleId.getVersion()) .putString(scheduleId.getSchedule()) .hash().asInt(); return Math.abs(hash) % numPartitions; }
@VisibleForTesting int getPartition(ScheduleId scheduleId) { // Similar to ScheduleId#hashCode, but that is not consistent across runtimes due to how Enum#hashCode works. // Ensure that the hash won't change across runtimes: int hash = Hashing.murmur3_32().newHasher() .putString(scheduleId.getNamespace()) .putString(scheduleId.getApplication()) .putString(scheduleId.getVersion()) .putString(scheduleId.getSchedule()) .hash().asInt(); return Math.abs(hash) % numPartitions; }
public ScheduleDetail toScheduleDetail() { ScheduleProgramInfo programInfo = new ScheduleProgramInfo(programId.getType().getSchedulableType(), programId.getProgram()); return new ScheduleDetail(scheduleId.getNamespace(), scheduleId.getApplication(), scheduleId.getVersion(), scheduleId.getSchedule(), description, programInfo, properties, trigger, constraints, timeoutMillis, null); } }
public ScheduleDetail toScheduleDetail() { ScheduleProgramInfo programInfo = new ScheduleProgramInfo(programId.getType().getSchedulableType(), programId.getProgram()); return new ScheduleDetail(scheduleId.getNamespace(), scheduleId.getApplication(), scheduleId.getVersion(), scheduleId.getSchedule(), description, programInfo, properties, trigger, constraints, timeoutMillis, null); } }
} else if (type.equals(TYPE_MAP.get(ScheduleId.class))) { ScheduleId scheduleId = (ScheduleId) namespacedEntityId; String namespaceId = scheduleId.getNamespace(); String appId = scheduleId.getApplication(); String version = scheduleId.getVersion();
} else if (type.equals(TYPE_MAP.get(ScheduleId.class))) { ScheduleId scheduleId = (ScheduleId) namespacedEntityId; String namespaceId = scheduleId.getNamespace(); String appId = scheduleId.getApplication(); String version = scheduleId.getVersion();
public void enableSchedule(ScheduleId scheduleId) throws Exception { MockResponder responder = new MockResponder(); String uri = String.format("%s/apps/%s/versions/%s/program-type/schedules/program-id/%s/action/enable", getNamespacePath(scheduleId.getNamespace()), scheduleId.getVersion(), scheduleId.getApplication(), scheduleId.getSchedule()); FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uri); HttpUtil.setContentLength(request, 0); programLifecycleHttpHandler.performAction(request, responder, scheduleId.getNamespace(), scheduleId.getApplication(), scheduleId.getVersion(), "schedules", scheduleId.getSchedule(), "enable"); verifyResponse(HttpResponseStatus.OK, responder.getStatus(), "Enable schedule failed"); }
public ScheduleDetail toScheduleDetail() { ScheduleProgramInfo programInfo = new ScheduleProgramInfo(schedule.getProgramId().getType().getSchedulableType(), schedule.getProgramId().getProgram()); ScheduleId scheduleId = schedule.getScheduleId(); return new ScheduleDetail(scheduleId.getNamespace(), scheduleId.getApplication(), scheduleId.getVersion(), scheduleId.getSchedule(), schedule.getDescription(), programInfo, schedule.getProperties(), schedule.getTrigger(), schedule.getConstraints(), schedule.getTimeoutMillis(), meta.getStatus().name()); } }
public ScheduleDetail toScheduleDetail() { ScheduleProgramInfo programInfo = new ScheduleProgramInfo(schedule.getProgramId().getType().getSchedulableType(), schedule.getProgramId().getProgram()); ScheduleId scheduleId = schedule.getScheduleId(); return new ScheduleDetail(scheduleId.getNamespace(), scheduleId.getApplication(), scheduleId.getVersion(), scheduleId.getSchedule(), schedule.getDescription(), programInfo, schedule.getProperties(), schedule.getTrigger(), schedule.getConstraints(), schedule.getTimeoutMillis(), meta.getStatus().name()); } }