Java Code Examples for org.apache.beam.sdk.options.Default#InstanceFactory

The following examples show how to use org.apache.beam.sdk.options.Default#InstanceFactory . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GcpOptions.java    From beam with Apache License 2.0 5 votes vote down vote up
/**
 * The credential instance that should be used to authenticate against GCP services. If no
 * credential has been set explicitly, the default is to use the instance factory that constructs
 * a credential based upon the currently set credentialFactoryClass.
 */
@JsonIgnore
@Description(
    "The credential instance that should be used to authenticate against GCP services. "
        + "If no credential has been set explicitly, the default is to use the instance factory "
        + "that constructs a credential based upon the currently set credentialFactoryClass.")
@Default.InstanceFactory(GcpUserCredentialsFactory.class)
Credentials getGcpCredential();
 
Example 2
Source File: PipelineOptionsTableGenerator.java    From beam with Apache License 2.0 5 votes vote down vote up
/** Returns a string representation of the {@link Default} value on the passed in method. */
private static Optional<String> getDefaultValueFromAnnotation(Method method) {
  for (Annotation annotation : method.getAnnotations()) {
    if (annotation instanceof Default.Class) {
      return Optional.of(((Default.Class) annotation).value().getSimpleName());
    } else if (annotation instanceof Default.String) {
      return Optional.of(((Default.String) annotation).value());
    } else if (annotation instanceof Default.Boolean) {
      return Optional.of(Boolean.toString(((Default.Boolean) annotation).value()));
    } else if (annotation instanceof Default.Character) {
      return Optional.of(Character.toString(((Default.Character) annotation).value()));
    } else if (annotation instanceof Default.Byte) {
      return Optional.of(Byte.toString(((Default.Byte) annotation).value()));
    } else if (annotation instanceof Default.Short) {
      return Optional.of(Short.toString(((Default.Short) annotation).value()));
    } else if (annotation instanceof Default.Integer) {
      return Optional.of(Integer.toString(((Default.Integer) annotation).value()));
    } else if (annotation instanceof Default.Long) {
      return Optional.of(Long.toString(((Default.Long) annotation).value()));
    } else if (annotation instanceof Default.Float) {
      return Optional.of(Float.toString(((Default.Float) annotation).value()));
    } else if (annotation instanceof Default.Double) {
      return Optional.of(Double.toString(((Default.Double) annotation).value()));
    } else if (annotation instanceof Default.Enum) {
      return Optional.of(((Default.Enum) annotation).value());
    } else if (annotation instanceof Default.InstanceFactory) {
      return Optional.of(((Default.InstanceFactory) annotation).value().getSimpleName());
    }
  }
  return Optional.empty();
}
 
Example 3
Source File: GcsOptions.java    From beam with Apache License 2.0 5 votes vote down vote up
/**
 * The ExecutorService instance to use to create threads, can be overridden to specify an
 * ExecutorService that is compatible with the user's environment. If unset, the default is to
 * create an ExecutorService with an unbounded number of threads; this is compatible with Google
 * AppEngine.
 */
@JsonIgnore
@Description(
    "The ExecutorService instance to use to create multiple threads. Can be overridden "
        + "to specify an ExecutorService that is compatible with the user's environment. If unset, "
        + "the default is to create an ExecutorService with an unbounded number of threads; this "
        + "is compatible with Google AppEngine.")
@Default.InstanceFactory(ExecutorServiceFactory.class)
@Hidden
ExecutorService getExecutorService();
 
Example 4
Source File: WindowedWordCount.java    From beam with Apache License 2.0 4 votes vote down vote up
@Description("Maximum randomly assigned timestamp, in milliseconds-since-epoch")
@Default.InstanceFactory(DefaultToMinTimestampPlusOneHour.class)
Long getMaxTimestampMillis();
 
Example 5
Source File: GcpOptions.java    From beam with Apache License 2.0 4 votes vote down vote up
@Description(
    "If true will use Streaming Engine.  Defaults to false unless the experiments enable_streaming_engine or enable_windmill_service are set.")
@Default.InstanceFactory(EnableStreamingEngineFactory.class)
boolean isEnableStreamingEngine();
 
Example 6
Source File: GcpOptions.java    From beam with Apache License 2.0 4 votes vote down vote up
/** Project id to use when launching jobs. */
@Description(
    "Project id. Required when using Google Cloud Platform services. "
        + "See https://cloud.google.com/storage/docs/projects for further details.")
@Default.InstanceFactory(DefaultProjectFactory.class)
String getProject();
 
Example 7
Source File: StreamingDataflowWorkerOptions.java    From beam with Apache License 2.0 4 votes vote down vote up
@Description(
    "Period for sending 'global get config' requests to the service. The duration is "
        + "specified as seconds in 'PTx.yS' format, e.g. 'PT5.125S'."
        + " Default is PT120S (2 minutes).")
@Default.InstanceFactory(GlobalConfigRefreshPeriodFactory.class)
Duration getGlobalConfigRefreshPeriod();
 
Example 8
Source File: MetricsOptions.java    From beam with Apache License 2.0 4 votes vote down vote up
@Description("The beam sink class to which the metrics will be pushed")
@Default.InstanceFactory(NoOpMetricsSink.class)
Class<? extends MetricsSink> getMetricsSink();
 
Example 9
Source File: ExamplePubsubTopicOptions.java    From beam with Apache License 2.0 4 votes vote down vote up
@Description("Pub/Sub topic")
@Default.InstanceFactory(PubsubTopicFactory.class)
String getPubsubTopic();
 
Example 10
Source File: SubProcessPipelineOptions.java    From deployment-examples with MIT License 4 votes vote down vote up
@Default.InstanceFactory(SubProcessConfigurationFactory.class)
SubProcessConfiguration getSubProcessConfiguration();
 
Example 11
Source File: WindowedWordCount.java    From beam with Apache License 2.0 4 votes vote down vote up
@Description("Minimum randomly assigned timestamp, in milliseconds-since-epoch")
@Default.InstanceFactory(DefaultToCurrentSystemTime.class)
Long getMinTimestampMillis();
 
Example 12
Source File: TestPipelineOptions.java    From beam with Apache License 2.0 4 votes vote down vote up
@Default.InstanceFactory(AlwaysPassMatcherFactory.class)
@JsonIgnore
SerializableMatcher<PipelineResult> getOnCreateMatcher();
 
Example 13
Source File: DirectOptions.java    From beam with Apache License 2.0 4 votes vote down vote up
@Default.InstanceFactory(AvailableParallelismFactory.class)
@Description(
    "Controls the amount of target parallelism the DirectRunner will use. Defaults to"
        + " the greater of the number of available processors and 3. Must be a value greater"
        + " than zero.")
int getTargetParallelism();
 
Example 14
Source File: TestSparkPipelineOptions.java    From beam with Apache License 2.0 4 votes vote down vote up
@Description(
    "A watermark (time in millis) that causes a pipeline that reads "
        + "from an unbounded source to stop.")
@Default.InstanceFactory(DefaultStopPipelineWatermarkFactory.class)
Long getStopPipelineWatermark();
 
Example 15
Source File: ExamplePubsubTopicAndSubscriptionOptions.java    From deployment-examples with MIT License 4 votes vote down vote up
@Description("Pub/Sub subscription")
@Default.InstanceFactory(PubsubSubscriptionFactory.class)
String getPubsubSubscription();
 
Example 16
Source File: GCSOptions.java    From dataflow-java with Apache License 2.0 4 votes vote down vote up
@Default.InstanceFactory(ScopesFactory.class)
@JsonIgnore
List<String> getScopes();
 
Example 17
Source File: SparkCommonPipelineOptions.java    From beam with Apache License 2.0 4 votes vote down vote up
@Description(
    "A checkpoint directory for streaming resilience, ignored in batch. "
        + "For durability, a reliable filesystem such as HDFS/S3/GS is necessary.")
@Default.InstanceFactory(TmpCheckpointDirFactory.class)
String getCheckpointDir();
 
Example 18
Source File: GCSOptions.java    From dataflow-java with Apache License 2.0 4 votes vote down vote up
@Default.InstanceFactory(JsonFactoryFactory.class)
@JsonIgnore
JsonFactory getJsonFactory();
 
Example 19
Source File: AwsOptions.java    From beam with Apache License 2.0 3 votes vote down vote up
/**
 * The client configuration instance that should be used to configure AWS service clients. Please
 * note that the configuration deserialization allows aws http client configuration settings.
 *
 * <p>For example, to set different timeout for aws client service : Note that all the below
 * fields are optional, so only add those configurations that need to be set. <code>
 * --clientConfiguration={
 *   "clientExecutionTimeout":1000,
 *   "connectionMaxIdleTime":3000,
 *   "connectionTimeout":10000,
 *   "requestTimeout":30,
 *   "socketTimeout":600,
 *   "maxConnections":10,
 *   "socketTimeout":5000
 * }
 * </code>
 *
 * @return
 */
@Description(
    "The client configuration instance that should be used to configure AWS http client configuration parameters."
        + "Mentioned parameters are the available parameters that can be set. All above parameters are "
        + "optional set only those that need custom changes.")
@Default.InstanceFactory(ClientConfigurationFactory.class)
ClientConfiguration getAwsHttpClientConfiguration();
 
Example 20
Source File: GcpOptions.java    From beam with Apache License 2.0 2 votes vote down vote up
/**
 * A GCS path for storing temporary files in GCP.
 *
 * <p>Its default to {@link PipelineOptions#getTempLocation}.
 */
@Description("A GCS path for storing temporary files in GCP.")
@Default.InstanceFactory(GcpTempLocationFactory.class)
@Nullable
String getGcpTempLocation();