flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mjsax <...@git.apache.org>
Subject [GitHub] flink pull request: Flink Storm compatibility
Date Tue, 12 May 2015 09:17:14 GMT
Github user mjsax commented on a diff in the pull request:

    https://github.com/apache/flink/pull/573#discussion_r30117019
  
    --- Diff: flink-staging/flink-streaming/flink-storm-compatibility/src/main/java/org/apache/flink/stormcompatibility/api/FlinkClient.java
---
    @@ -0,0 +1,321 @@
    +/*
    + * 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.stormcompatibility.api;
    +
    +import java.io.File;
    +import java.io.IOException;
    +import java.net.InetSocketAddress;
    +import java.net.UnknownHostException;
    +import java.util.ArrayList;
    +import java.util.List;
    +import java.util.Map;
    +
    +import org.apache.flink.api.common.JobID;
    +import org.apache.flink.client.program.Client;
    +import org.apache.flink.client.program.JobWithJars;
    +import org.apache.flink.client.program.ProgramInvocationException;
    +import org.apache.flink.configuration.ConfigConstants;
    +import org.apache.flink.configuration.Configuration;
    +import org.apache.flink.configuration.GlobalConfiguration;
    +import org.apache.flink.core.fs.Path;
    +import org.apache.flink.runtime.akka.AkkaUtils;
    +import org.apache.flink.runtime.client.JobStatusMessage;
    +import org.apache.flink.runtime.jobgraph.JobGraph;
    +import org.apache.flink.runtime.jobmanager.JobManager;
    +import org.apache.flink.runtime.messages.JobManagerMessages;
    +import org.apache.flink.runtime.messages.JobManagerMessages.CancelJob;
    +import org.apache.flink.runtime.messages.JobManagerMessages.RunningJobsStatus;
    +
    +import scala.Some;
    +import scala.concurrent.Await;
    +import scala.concurrent.Future;
    +import scala.concurrent.duration.FiniteDuration;
    +import akka.actor.ActorRef;
    +import akka.actor.ActorSystem;
    +import akka.pattern.Patterns;
    +import akka.util.Timeout;
    +import backtype.storm.Config;
    +import backtype.storm.generated.AlreadyAliveException;
    +import backtype.storm.generated.InvalidTopologyException;
    +import backtype.storm.generated.KillOptions;
    +import backtype.storm.generated.Nimbus;
    +import backtype.storm.generated.NotAliveException;
    +import backtype.storm.generated.SubmitOptions;
    +import backtype.storm.utils.NimbusClient;
    +import backtype.storm.utils.Utils;
    +
    +
    +
    +
    +
    +/**
    + * {@link FlinkClient} mimics a Storm {@link NimbusClient} and {@link Nimbus}{@code .Client}
at once, to interact with
    + * Flink's JobManager instead of Storm's Nimbus.
    + */
    +public class FlinkClient {
    +	/**
    +	 * The jobmanager's host name.
    +	 */
    +	private final String jobManagerHost;
    +	/**
    +	 * The jobmanager's rpc port.
    +	 */
    +	private final int jobManagerPort;
    +	/**
    +	 * The user specified timeout in milliseconds.
    +	 */
    +	private final String timeout;
    +	
    +	
    +	
    +	/*
    +	 * The following methods are derived from "backtype.storm.utils.NimbusClient"
    +	 */
    +	
    +	/**
    +	 * Instantiates a new {@link FlinkClient} for the given configuration, host name, and
port. If values for
    +	 * {@link Config#NIMBUS_HOST} and {@link Config#NIMBUS_THRIFT_PORT} of the given configuration
are ignored.
    +	 * 
    +	 * @param conf
    +	 *            A configuration.
    +	 * @param host
    +	 *            The jobmanager's host name.
    +	 * @param port
    +	 *            The jobmanager's rpc port.
    +	 */
    +	public FlinkClient(final Map<?, ?> conf, final String host, final int port) {
    +		this(conf, host, port, null);
    +	}
    +	
    +	/**
    +	 * Instantiates a new {@link FlinkClient} for the given configuration, host name, and
port. If values for
    +	 * {@link Config#NIMBUS_HOST} and {@link Config#NIMBUS_THRIFT_PORT} of the given configuration
are ignored.
    +	 * 
    +	 * @param conf
    +	 *            A configuration.
    +	 * @param host
    +	 *            The jobmanager's host name.
    +	 * @param port
    +	 *            The jobmanager's rpc port.
    +	 * @param timeout
    +	 */
    +	public FlinkClient(final Map<?, ?> conf, final String host, final int port, final
Integer timeout) {
    --- End diff --
    
    FlinkClient offers the unified interface as NimbusClient and Nimbus.Client (in the compatibility
layer, it does not make sense to destingues both). Thus, the constructor offers the same parameters
(even in not used right now). The same holds for Map -- Storm does not use any generics.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message