flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 윤형덕 <ynoo...@naver.com>
Subject Re: inheritance of Program interface in Program.java in org.apache.flink.api.common
Date Fri, 20 May 2016 17:38:21 GMT
 then this.program of PackageProgram's object has null. [1]
in run() of CliFrontend.java, invokes executeProgramBlocking(program, client, userParallelism)
[2]
and this method invokes client.runBlocking(program, parallelism) [3]
and this method invokes runBlocking(prog.getPlanWithJars(), parallelism, prog.getSavepointPath())
that is overloaded function[4]
and prog.getPlanWithJars() invokes getPlan() of PackagedProgram.java[5]
and getPlan() invokes createPlanFromProgram(this.program, this.args); [6]
and createPlanFromProgram's source is folowing
 
private static Plan createPlanFromProgram(Program program, String[] options) throws ProgramInvocationException
{
    try {
      return program.getPlan(options);
    } catch (Throwable t) {
      throw new ProgramInvocationException("Error while calling the program: " + t.getMessage(),
t);
    }
}
 
as we checked, this.program has null. so if we invoke program.getPlan(options), exception
will happen.
but when i runned program, exception didn't occur.
i'd appreciate if you explain this.
 
[1]
else if (hasMainMethod(mainClass)) {
this.program = null;
 
[2]
if (options.getDetachedMode() || (yarnCluster != null &amp;&amp; yarnCluster.isDetached()))
{
     exitCode = executeProgramDetached(program, client, userParallelism);
} else {
     exitCode = executeProgramBlocking(program, client, userParallelism);
}
 
[3]
protected int executeProgramBlocking(PackagedProgram program, Client client, int parallelism)
{
  LOG.info("Starting execution of program");
  JobSubmissionResult result;
  try {
     result = client.runBlocking(program, parallelism);
  }
 
[4]
public JobSubmissionResult runBlocking(PackagedProgram prog, int parallelism) throws ProgramInvocationException
{
  Thread.currentThread().setContextClassLoader(prog.getUserCodeClassLoader());
  if (prog.isUsingProgramEntryPoint()) {
    return runBlocking(prog.getPlanWithJars(), parallelism, prog.getSavepointPath());
  }
 
[5]
public JobWithJars getPlanWithJars() throws ProgramInvocationException {
  if (isUsingProgramEntryPoint()) {
     return new JobWithJars(getPlan(), getAllLibraries(), classpaths, userCodeClassLoader);
 
[6]
private Plan getPlan() throws ProgramInvocationException {
  if (this.plan == null) {
     Thread.currentThread().setContextClassLoader(this.userCodeClassLoader);
     this.plan = createPlanFromProgram(this.program, this.args);
  }
  return this.plan;
}
 
 
-----Original Message-----
From: "Ufuk Celebi"&lt;uce@apache.org&gt; 
To: &lt;user@flink.apache.org&gt;; "윤형덕"&lt;ynoohe1@naver.com&gt;; 
Cc: 
Sent: 2016-05-20 (금) 19:30:01
Subject: Re: inheritance of Program interface in Program.java in org.apache.flink.api.common
 

On Thu, May 19, 2016 at 4:46 PM, 윤형덕 &lt;ynoohe1@naver.com&gt; wrote:
&gt;
&gt; how can this.mainClass that doesn't override getPlan method that is abstract method
of Program interface(program.class) and has only static main method be instantiate as Program?


This is only called if the class is actually a subclass of Program. That's why there is the
`isAssignable` check. Otherwise, we check that there is a mainMethod (else if (hasMainMethod(mainClass)).
If this is not the case, a ProgramInvocationException is thrown.


Mime
View raw message