Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@
import org.apache.beam.sdk.transforms.windowing.GlobalWindows;
import org.apache.beam.sdk.transforms.windowing.Window;
import org.apache.beam.sdk.util.CoderUtils;
import org.apache.beam.sdk.util.DataflowReleaseInfo;
import org.apache.beam.sdk.util.DataflowTransport;
import org.apache.beam.sdk.util.IOChannelUtils;
import org.apache.beam.sdk.util.InstanceBuilder;
import org.apache.beam.sdk.util.MonitoringUtil;
import org.apache.beam.sdk.util.PCollectionViews;
import org.apache.beam.sdk.util.PathValidator;
import org.apache.beam.sdk.util.PropertyNames;
import org.apache.beam.sdk.util.ReleaseInfo;
import org.apache.beam.sdk.util.Reshuffle;
import org.apache.beam.sdk.util.SystemDoFnInternal;
import org.apache.beam.sdk.util.ValueWithRecordId;
Expand Down Expand Up @@ -507,10 +507,10 @@ public DataflowPipelineJob run(Pipeline pipeline) {
Job newJob = jobSpecification.getJob();
newJob.setClientRequestId(requestId);

String version = DataflowReleaseInfo.getReleaseInfo().getVersion();
String version = ReleaseInfo.getReleaseInfo().getVersion();
System.out.println("Dataflow SDK version: " + version);

newJob.getEnvironment().setUserAgent(DataflowReleaseInfo.getReleaseInfo());
newJob.getEnvironment().setUserAgent(ReleaseInfo.getReleaseInfo());
// The Dataflow Service may write to the temporary directory directly, so
// must be verified.
if (!Strings.isNullOrEmpty(options.getTempLocation())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
import org.apache.beam.sdk.transforms.windowing.IntervalWindow;
import org.apache.beam.sdk.transforms.windowing.PaneInfo;
import org.apache.beam.sdk.util.CoderUtils;
import org.apache.beam.sdk.util.DataflowReleaseInfo;
import org.apache.beam.sdk.util.GcsUtil;
import org.apache.beam.sdk.util.NoopPathValidator;
import org.apache.beam.sdk.util.ReleaseInfo;
import org.apache.beam.sdk.util.TestCredential;
import org.apache.beam.sdk.util.UserCodeException;
import org.apache.beam.sdk.util.WindowedValue;
Expand Down Expand Up @@ -375,10 +375,10 @@ public void testRunWithFiles() throws IOException {
cloudDataflowDataset,
workflowJob.getEnvironment().getDataset());
assertEquals(
DataflowReleaseInfo.getReleaseInfo().getName(),
ReleaseInfo.getReleaseInfo().getName(),
workflowJob.getEnvironment().getUserAgent().get("name"));
assertEquals(
DataflowReleaseInfo.getReleaseInfo().getVersion(),
ReleaseInfo.getReleaseInfo().getVersion(),
workflowJob.getEnvironment().getUserAgent().get("version"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.runners.PipelineRunner;
import org.apache.beam.sdk.transforms.PTransform;
import org.apache.beam.sdk.util.DataflowReleaseInfo;
import org.apache.beam.sdk.util.ReleaseInfo;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PBegin;
import org.apache.beam.sdk.values.PCollection;
Expand Down Expand Up @@ -978,7 +978,7 @@ public BigtableWriteException(KV<ByteString, Iterable<Mutation>> record, Throwab
*/
private static String getUserAgent() {
String javaVersion = System.getProperty("java.specification.version");
DataflowReleaseInfo info = DataflowReleaseInfo.getReleaseInfo();
ReleaseInfo info = ReleaseInfo.getReleaseInfo();
return String.format(
"%s/%s (%s); %s",
info.getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@
import java.util.Properties;

/**
* Utilities for working with the Dataflow distribution.
* Utilities for working with release information.
*/
public final class DataflowReleaseInfo extends GenericJson {
private static final Logger LOG = LoggerFactory.getLogger(DataflowReleaseInfo.class);
public final class ReleaseInfo extends GenericJson {
private static final Logger LOG = LoggerFactory.getLogger(ReleaseInfo.class);

private static final String DATAFLOW_PROPERTIES_PATH =
"/org.apache.beam/sdk/sdk.properties";
private static final String PROPERTIES_PATH =
"/org/apache/beam/sdk/sdk.properties";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename file to BeamReleaseInfo or just ReleaseInfo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


private static class LazyInit {
private static final DataflowReleaseInfo INSTANCE =
new DataflowReleaseInfo(DATAFLOW_PROPERTIES_PATH);
private static final ReleaseInfo INSTANCE =
new ReleaseInfo(PROPERTIES_PATH);
}

/**
* Returns an instance of DataflowReleaseInfo.
*/
public static DataflowReleaseInfo getReleaseInfo() {
public static ReleaseInfo getReleaseInfo() {
return LazyInit.INSTANCE;
}

@Key private String name = "Google Cloud Dataflow Java SDK";
@Key private String name = "Apache Beam SDK for Java";
@Key private String version = "Unknown";

/** Provides the SDK name. */
Expand All @@ -61,11 +61,11 @@ public String getVersion() {
return version;
}

private DataflowReleaseInfo(String resourcePath) {
private ReleaseInfo(String resourcePath) {
Properties properties = new Properties();

InputStream in = DataflowReleaseInfo.class.getResourceAsStream(
DATAFLOW_PROPERTIES_PATH);
InputStream in = ReleaseInfo.class.getResourceAsStream(
PROPERTIES_PATH);
if (in == null) {
LOG.warn("Dataflow properties resource not found: {}", resourcePath);
return;
Expand Down