@Test public void testToS3LogLocationTaskContext() { assertS3LogLocationInTaskContextNotSet(LogStorageInfos.toS3LogLocationTaskContext(JobGenerator.oneBatchJob())); assertS3LogLocationInTaskContext( LogStorageInfos.toS3LogLocationTaskContext(newJob("bucketA", "pathB")), "bucketA", "pathB" ); }
public static <E extends JobDescriptor.JobDescriptorExt> Map<String, String> toS3LogLocationTaskContext(Job<E> job) { Map<String, String> context = new HashMap<>(); Map<String, String> attributes = job.getJobDescriptor().getContainer().getAttributes(); Evaluators.applyNotNull( attributes.get(JobAttributes.JOB_CONTAINER_ATTRIBUTE_S3_BUCKET_NAME), value -> context.put(TaskAttributes.TASK_ATTRIBUTE_S3_BUCKET_NAME, value) ); Evaluators.applyNotNull( attributes.get(JobAttributes.JOB_CONTAINER_ATTRIBUTE_S3_PATH_PREFIX), value -> context.put(TaskAttributes.TASK_ATTRIBUTE_S3_PATH_PREFIX, value) ); return context; }
LogStorageInfos { public static <E extends JobDescriptor.JobDescriptorExt> Map<String, String> toS3LogLocationTaskContext(Job<E> job) { Map<String, String> context = new HashMap<>(); Map<String, String> attributes = job.getJobDescriptor().getContainer().getAttributes(); Evaluators.applyNotNull( attributes.get(JobAttributes.JOB_CONTAINER_ATTRIBUTE_S3_BUCKET_NAME), value -> context.put(TaskAttributes.TASK_ATTRIBUTE_S3_BUCKET_NAME, value) ); Evaluators.applyNotNull( attributes.get(JobAttributes.JOB_CONTAINER_ATTRIBUTE_S3_PATH_PREFIX), value -> context.put(TaskAttributes.TASK_ATTRIBUTE_S3_PATH_PREFIX, value) ); return context; } }
LogStorageInfos { public static <E extends JobDescriptor.JobDescriptorExt> Map<String, String> toS3LogLocationTaskContext(Job<E> job) { Map<String, String> context = new HashMap<>(); Map<String, String> attributes = job.getJobDescriptor().getContainer().getAttributes(); Evaluators.applyNotNull( attributes.get(JobAttributes.JOB_CONTAINER_ATTRIBUTE_S3_BUCKET_NAME), value -> context.put(TaskAttributes.TASK_ATTRIBUTE_S3_BUCKET_NAME, value) ); Evaluators.applyNotNull( attributes.get(JobAttributes.JOB_CONTAINER_ATTRIBUTE_S3_PATH_PREFIX), value -> context.put(TaskAttributes.TASK_ATTRIBUTE_S3_PATH_PREFIX, value) ); return context; }  }
LogStorageInfos { public static <E extends JobDescriptor.JobDescriptorExt> Map<String, String> toS3LogLocationTaskContext(Job<E> job) { Map<String, String> context = new HashMap<>(); Map<String, String> attributes = job.getJobDescriptor().getContainer().getAttributes(); Evaluators.applyNotNull( attributes.get(JobAttributes.JOB_CONTAINER_ATTRIBUTE_S3_BUCKET_NAME), value -> context.put(TaskAttributes.TASK_ATTRIBUTE_S3_BUCKET_NAME, value) ); Evaluators.applyNotNull( attributes.get(JobAttributes.JOB_CONTAINER_ATTRIBUTE_S3_PATH_PREFIX), value -> context.put(TaskAttributes.TASK_ATTRIBUTE_S3_PATH_PREFIX, value) ); return context; }  static Map<String, String> toS3LogLocationTaskContext(Job<E> job); static S3LogLocation buildLogLocation(Task task, S3LogLocation defaultLogLocation); static Optional<S3Bucket> findCustomS3Bucket(Job<?> job); static Optional<S3Bucket> findCustomS3Bucket(JobDescriptor<?> jobDescriptor); static Optional<S3Bucket> findCustomS3Bucket(Task task); static Optional<String> findCustomPathPrefix(JobDescriptor<?> jobDescriptor); static Optional<String> findCustomPathPrefix(Task task); static String buildPathPrefix(String first, String second); }
LogStorageInfos { public static <E extends JobDescriptor.JobDescriptorExt> Map<String, String> toS3LogLocationTaskContext(Job<E> job) { Map<String, String> context = new HashMap<>(); Map<String, String> attributes = job.getJobDescriptor().getContainer().getAttributes(); Evaluators.applyNotNull( attributes.get(JobAttributes.JOB_CONTAINER_ATTRIBUTE_S3_BUCKET_NAME), value -> context.put(TaskAttributes.TASK_ATTRIBUTE_S3_BUCKET_NAME, value) ); Evaluators.applyNotNull( attributes.get(JobAttributes.JOB_CONTAINER_ATTRIBUTE_S3_PATH_PREFIX), value -> context.put(TaskAttributes.TASK_ATTRIBUTE_S3_PATH_PREFIX, value) ); return context; }  static Map<String, String> toS3LogLocationTaskContext(Job<E> job); static S3LogLocation buildLogLocation(Task task, S3LogLocation defaultLogLocation); static Optional<S3Bucket> findCustomS3Bucket(Job<?> job); static Optional<S3Bucket> findCustomS3Bucket(JobDescriptor<?> jobDescriptor); static Optional<S3Bucket> findCustomS3Bucket(Task task); static Optional<String> findCustomPathPrefix(JobDescriptor<?> jobDescriptor); static Optional<String> findCustomPathPrefix(Task task); static String buildPathPrefix(String first, String second);  }