dianfu commented on a change in pull request #8532: [FLINK-12541][REST] Support to submit Python Table API jobs via REST API URL: https://github.com/apache/flink/pull/8532#discussion_r292027033
########## File path: flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/ArtifactRequestBody.java ########## @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.flink.runtime.webmonitor.handlers; + +import org.apache.flink.api.common.JobID; +import org.apache.flink.runtime.rest.messages.RequestBody; +import org.apache.flink.runtime.rest.messages.json.JobIDDeserializer; +import org.apache.flink.runtime.rest.messages.json.JobIDSerializer; + +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator; +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore; +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonInclude; +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import javax.annotation.Nullable; + +import java.util.List; + +/** + * Base class for {@link RequestBody} for running an artifact or querying the plan. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public abstract class ArtifactRequestBody implements RequestBody { + + static final String FIELD_NAME_ENTRY_CLASS = "entryClass"; + static final String FIELD_NAME_PROGRAM_ARGUMENTS = "programArgs"; + static final String FIELD_NAME_PROGRAM_ARGUMENTS_LIST = "programArgsList"; + static final String FIELD_NAME_PARALLELISM = "parallelism"; + static final String FIELD_NAME_DEPENDENT_ARTIFACT_ID = "dependentArtifactId"; + static final String FIELD_NAME_JOB_ID = "jobId"; + + @JsonProperty(FIELD_NAME_ENTRY_CLASS) + @Nullable + private String entryClassName; + + @JsonProperty(FIELD_NAME_PROGRAM_ARGUMENTS) + @Nullable + private String programArguments; + + @JsonProperty(FIELD_NAME_PROGRAM_ARGUMENTS_LIST) + @Nullable + private List<String> programArgumentsList; + + @JsonProperty(FIELD_NAME_PARALLELISM) + @Nullable + private Integer parallelism; + + @JsonProperty(FIELD_NAME_DEPENDENT_ARTIFACT_ID) + @Nullable + private String dependentArtifactId; + + @JsonProperty(FIELD_NAME_JOB_ID) + @JsonDeserialize(using = JobIDDeserializer.class) + @JsonSerialize(using = JobIDSerializer.class) + @Nullable + private JobID jobId; + + ArtifactRequestBody() { + this(null, null, null, null, null, null); + } + + @JsonCreator + ArtifactRequestBody( + @Nullable @JsonProperty(FIELD_NAME_ENTRY_CLASS) String entryClassName, + @Nullable @JsonProperty(FIELD_NAME_PROGRAM_ARGUMENTS) String programArguments, + @Nullable @JsonProperty(FIELD_NAME_PROGRAM_ARGUMENTS_LIST) List<String> programArgumentsList, + @Nullable @JsonProperty(FIELD_NAME_PARALLELISM) Integer parallelism, + @Nullable @JsonProperty(FIELD_NAME_DEPENDENT_ARTIFACT_ID) String dependentArtifactId, + @Nullable @JsonProperty(FIELD_NAME_JOB_ID) JobID jobId) { + this.entryClassName = entryClassName; + this.programArguments = programArguments; + this.programArgumentsList = programArgumentsList; + this.parallelism = parallelism; + this.dependentArtifactId = dependentArtifactId; + this.jobId = jobId; + } + + @Nullable + @JsonIgnore + public String getEntryClassName() { + return entryClassName; + } + + @Nullable + @JsonIgnore + public String getProgramArguments() { + return programArguments; + } + + @Nullable + @JsonIgnore + public List<String> getProgramArgumentsList() { + return programArgumentsList; + } + + @Nullable + @JsonIgnore + public Integer getParallelism() { + return parallelism; + } + + @Nullable + @JsonIgnore + public String getDependentArtifactId() { Review comment: This parameter allows to specify a separate jar file as the dependency. What do you think? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
