title: Flink: Dataset and Datastream API in one program. Is it possible?
body: <p>I want to first manipulate static data using dataset API and then use DataStream API to run a streaming job. If I write code on IDE, it works perfectly. But when I try running on local flink jobmanager (all parallelism 1), the streaming code never executes!</p>
  
  <p>For example, the following code is not working:</p>
  
  <pre><code>val parallelism = 1
  
  val env = StreamExecutionEnvironment.getExecutionEnvironment
  env.setParallelism(parallelism)
  
  val envStatic = ExecutionEnvironment.getExecutionEnvironment
  envStatic.setParallelism(parallelism)
  
  val myStaticData = envStatic.fromCollection(1 to 10)
  val myVal: Int = myStaticData.reduce(_ + _).collect().head
  
  val theStream = env.fromElements(1).iterate( iteretion =&gt; {
    val result = iteretion.map(x =&gt; x + myVal)
    (result, result)
  })
  theStream.print()
  env.execute("static and streaming together")
  </code></pre>
  
  <p>What should I try to get this thing working?</p>
  
  <p>Logs:<a href="http://students.iitmandi.ac.in/~vishal_goel/log.txt" rel="nofollow">execution logs for above program</a></p>
  
  <p>Execution plan: <a href="http://students.iitmandi.ac.in/~vishal_goel/plan.png" rel="nofollow">plan</a>
  Seems to be a-cyclic.</p>