title: Running same DF template in parallel yields strange results
body: <p>I have a dataflow job that extracts data from Cloud SQL and loads it into Cloud Storage. We've configured the job to accept parameters so we can use the same code to extract multiple tables. The dataflow job is compiled as a template.  </p>
  
  <p>When we create/run instances of the template in serial we get the results we expect. However if we create/run instances in parallel only a few files turn up on Cloud Storage. In both cases we can see that the DF jobs are created and terminate sucessfully.</p>
  
  <p>For example we have 11 instances which produce 11 output files. In serial we get all 11 files, in parallel we only get around 3 files. During the parallel run all 11 instances were running at the same time</p>
  
  <p>Can anyone offer some advice as to why this is happening? I'm assuming that temporary files created by the DF template are somehow overwritten during the parallel run?</p>
  
  <p>The main motivation of running in parallel is extracting the data more quickly. </p>
  
  <p><strong>Edit</strong></p>
  
  <p>The pipeline is pretty simple:</p>
  
  <pre><code>        PCollection&lt;String&gt; results =  p
              .apply("Read from Cloud SQL", JdbcIO.&lt;String&gt;read()
                  .withDataSourceConfiguration(JdbcIO.DataSourceConfiguration
                          .create(dsDriver, dsConnection)
                          .withUsername(options.getCloudSqlUsername())
                          .withPassword(options.getCloudSqlPassword())
                  )
                  .withQuery(options.getCloudSqlExtractSql())
                  .withRowMapper(new JdbcIO.RowMapper&lt;String&gt;() {
                      @Override
                      public String mapRow(ResultSet resultSet) throws Exception {
                          return mapRowToJson(resultSet);
                      }
                  })
                  .withCoder(StringUtf8Coder.of()));
  </code></pre>
  
  <p>When I compile the template I do</p>
  
  <pre><code>mvn compile exec:java \
   -Dexec.mainClass=com.xxxx.batch_ingestion.LoadCloudSql \
   -Dexec.args="--project=myproject \
      --region=europe-west1 \
      --stagingLocation=gs://bucket/dataflow/staging/ \
      --cloudStorageLocation=gs://bucket/data/ \
      --cloudSqlInstanceId=yyyy \
      --cloudSqlSchema=dev \
      --runner=DataflowRunner \
      --templateLocation=gs://bucket/dataflow/template/BatchIngestion"
  </code></pre>
  
  <p>When I invoke the template I also provide "tempLocation". I can see the dynamic temp locations are being used. Despite this I'm not seeing all the output files when running in parallel.</p>
  
  <p>Thanks</p>