Skip to content

Commit

Permalink
Cloning extra-files on launcher vms.
Browse files Browse the repository at this point in the history
  • Loading branch information
VardhanThigle committed Jan 24, 2025
1 parent cf43da3 commit dfc3c6f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.beam.sdk.transforms.PTransform;
import org.apache.beam.sdk.values.PBegin;
import org.apache.beam.sdk.values.PCollection;
Expand All @@ -45,6 +49,16 @@ class CassandraIOWrapperHelper {
private static final Logger LOG = LoggerFactory.getLogger(CassandraIOWrapperHelper.class);

static DataSource buildDataSource(String gcsPath) {
// DO NOT SUBMIT
try {
LOG.info(
"Extra Files are {}",
Files.list(Paths.get("/extra_files"))
.map(p -> p.getFileName())
.collect(Collectors.toList()));
} catch (IOException e) {
throw new RuntimeException(e);
}
DataSource dataSource;
try {
dataSource =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.google.cloud.teleport.metadata.Template;
import com.google.cloud.teleport.metadata.TemplateCategory;
import com.google.cloud.teleport.v2.common.CommonTemplateJvmInitializer;
import com.google.cloud.teleport.v2.common.UncaughtExceptionLogger;
import com.google.cloud.teleport.v2.options.SourceDbToSpannerOptions;
import com.google.cloud.teleport.v2.spanner.migrations.shard.Shard;
Expand Down Expand Up @@ -85,6 +86,9 @@ public static void main(String[] args) {
// Parse the user options passed from the command-line
SourceDbToSpannerOptions options =
PipelineOptionsFactory.fromArgs(args).withValidation().as(SourceDbToSpannerOptions.class);
// Stage SSL certificates to extraFiles if required as per the pipeline options.
// Ref https://cloud.google.com/dataflow/docs/guides/templates/ssl-certificates
new CommonTemplateJvmInitializer().beforeProcessing(options);
run(options);
}

Expand Down

0 comments on commit dfc3c6f

Please sign in to comment.