@Override void runCmd() throws Exception { String json = Utils.printJson(admin.functions().getFunction(tenant, namespace, functionName)); Gson gson = new GsonBuilder().setPrettyPrinting().create(); System.out.println(gson.toJson(new JsonParser().parse(json))); } }
@Override public void validateField(String name, Object o, ClassLoader classLoader) { if (o == null) { return; } new StringValidator().validateField(name, o, classLoader); String path = (String) o; if(!Utils.isFunctionPackageUrlSupported(path)) { // check file existence if path is not url and local path if (!path.startsWith(Utils.BUILTIN) && !fileExists(path)) { throw new IllegalArgumentException (String.format("File %s specified in field '%s' does not exist", path, name)); } } } }
public static Class<?>[] getFunctionTypes(FunctionConfig functionConfig, ClassLoader classLoader) { Object userClass = createInstance(functionConfig.getClassName(), classLoader); boolean isWindowConfigPresent = functionConfig.getWindowConfig() != null; return getFunctionTypes(userClass, isWindowConfigPresent); }
@Override void runCmd() throws Exception { if (Utils.isFunctionPackageUrlSupported(archive)) { admin.functions().createFunctionWithUrl(SinkConfigUtils.convert(sinkConfig), sinkConfig.getArchive()); } else { admin.functions().createFunction(SinkConfigUtils.convert(sinkConfig), sinkConfig.getArchive()); } print("Created successfully"); } }
if (Utils.isFunctionPackageUrlSupported(sinkConfig.getArchive())) { return; Collections.emptySet())) { String sinkClassName = ConnectorUtils.getIOSinkClass(sinkConfig.getArchive()); Class<?> typeArg = getSinkType(sinkClassName, clsLoader);
if (functionConfig.getRuntime() == FunctionConfig.Runtime.JAVA) { if (classLoader != null) { typeArgs = Utils.getFunctionTypes(functionConfig, classLoader); functionDetailsBuilder.setRuntime(Utils.convertRuntime(functionConfig.getRuntime())); Utils.convertProcessingGuarantee(functionConfig.getProcessingGuarantees()));
typeArg = getSourceType(sourceClassName, ncl).getName(); if (sourceConfig.getProcessingGuarantees() != null) { functionDetailsBuilder.setProcessingGuarantees( convertProcessingGuarantee(sourceConfig.getProcessingGuarantees()));
try (NarClassLoader ncl = NarClassLoader.getFromArchive(new File(sinkConfig.getArchive()), Collections.emptySet())) { typeArg = Utils.getSinkType(sinkClassName, ncl).getName(); if (sinkConfig.getProcessingGuarantees() != null) { functionDetailsBuilder.setProcessingGuarantees( convertProcessingGuarantee(sinkConfig.getProcessingGuarantees()));
instanceConfig.setInstanceId(i + instanceIdOffset); instanceConfig.setMaxBufferedTuples(1024); instanceConfig.setPort(Utils.findAvailablePort()); RuntimeSpawner runtimeSpawner = new RuntimeSpawner( instanceConfig,
private static void doJavaChecks(FunctionConfig functionConfig, String name, ClassLoader clsLoader) { Class<?>[] typeArgs = Utils.getFunctionTypes(functionConfig, clsLoader);
@Override void runCmd() throws Exception { if (Utils.isFunctionPackageUrlSupported(this.sourceConfig.getArchive())) { admin.functions().createFunctionWithUrl(SourceConfigUtils.convert(sourceConfig), sourceConfig.getArchive()); } else { admin.functions().createFunction(SourceConfigUtils.convert(sourceConfig), sourceConfig.getArchive()); } print("Created successfully"); } }
boolean isArchivePathUrl = Utils.isFunctionPackageUrlSupported(sinkConfig.getArchive()); if (!fileExists(archivePath)) { throw new ParameterException("Archive file " + archivePath + " does not exist");
@Override void runCmd() throws Exception { String json = Utils.printJson(admin.worker().getFunctionsStats()); GsonBuilder gsonBuilder = new GsonBuilder(); if (indent) { gsonBuilder.setPrettyPrinting(); } System.out.println(gsonBuilder.create().toJson(new JsonParser().parse(json))); } }
@Override void runCmd() throws Exception { if (Utils.isFunctionPackageUrlSupported(functionConfig.getJar())) { admin.functions().createFunctionWithUrl(FunctionConfigUtils.convert(functionConfig, classLoader), functionConfig.getJar()); } else { admin.functions().createFunction(FunctionConfigUtils.convert(functionConfig, classLoader), userCodeFile); } print("Created successfully"); } }
boolean isArchivePathUrl = Utils.isFunctionPackageUrlSupported(sourceConfig.getArchive()); if (!fileExists(archivePath)) { throw new ParameterException("Archive file " + archivePath + " does not exist");
@Override void runCmd() throws Exception { String json = Utils.printJson( isBlank(instanceId) ? admin.functions().getFunctionStatus(tenant, namespace, functionName) : admin.functions().getFunctionStatus(tenant, namespace, functionName, Integer.parseInt(instanceId))); Gson gson = new GsonBuilder().setPrettyPrinting().create(); System.out.println(gson.toJson(new JsonParser().parse(json))); } }
@Override void runCmd() throws Exception { if (Utils.isFunctionPackageUrlSupported(functionConfig.getJar())) { admin.functions().updateFunctionWithUrl(FunctionConfigUtils.convert(functionConfig, classLoader), functionConfig.getJar()); } else { admin.functions().updateFunction(FunctionConfigUtils.convert(functionConfig, classLoader), userCodeFile); } print("Updated successfully"); } }
boolean isJarPathUrl = isNotBlank(functionConfig.getJar()) && Utils.isFunctionPackageUrlSupported(functionConfig.getJar()); String jarFilePath = null; if (isJarPathUrl) { if (!fileExists(userCodeFile)) { throw new ParameterException("File " + userCodeFile + " does not exist");
@Override public void processRecord(InstanceCommunication.MetricsData record, Function.FunctionDetails FunctionDetails) { if (isFileStart) { String filenamePrefix = filenameKey + "." + FunctionDetailsUtils.getFullyQualifiedName(FunctionDetails); writer = openNewFile(String.format("%s.%d", filenamePrefix, currentFileIndex)); writer.print("["); isFileStart = false; } else { writer.print(","); } try { String metrics = Utils.printJson(record); writer.print(metrics); } catch (Exception ex) { } }
@Override void runCmd() throws Exception { if (Utils.isFunctionPackageUrlSupported(archive)) { admin.functions().updateFunctionWithUrl(SinkConfigUtils.convert(sinkConfig), sinkConfig.getArchive()); } else { admin.functions().updateFunction(SinkConfigUtils.convert(sinkConfig), sinkConfig.getArchive()); } print("Updated successfully"); } }