autumnust commented on a change in pull request #3158: URL: https://github.com/apache/gobblin/pull/3158#discussion_r595372104
########## File path: gobblin-core/src/main/java/org/apache/gobblin/destination/DestinationDatasetHandler.java ########## @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.gobblin.destination; + +import java.io.Closeable; +import java.io.IOException; +import java.util.Collection; +import org.apache.gobblin.source.workunit.WorkUnit; + +/** + * Performs work related to initializing the target environment before the files are written and published + */ +public interface DestinationDatasetHandler extends Closeable { + + /** + * Adds required properties to work units for determining writer staging and output paths Review comment: The purpose for this class doesn't have to be very specific to the sharding thing. ########## File path: gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java ########## @@ -912,13 +915,14 @@ private void cleanLeftoverStagingData(WorkUnitStream workUnits, JobState jobStat } try { - if (this.jobContext.shouldCleanupStagingDataPerTask()) { + if (this.jobContext.shouldCleanupStagingDataPerTask() || jobState.getPropAsBoolean(ConfigurationKeys.USE_DATASET_LOCAL_WORK_DIR)) { Review comment: should the second condition be part of the first one by modifying `shouldCleanupStagingDataPerTask` ? ########## File path: gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java ########## @@ -972,7 +974,7 @@ private void cleanupStagingData(JobState jobState) throw new JobException("Failed to check unfinished commit sequences", e); } - if (this.jobContext.shouldCleanupStagingDataPerTask()) { + if (this.jobContext.shouldCleanupStagingDataPerTask() || jobState.getPropAsBoolean(ConfigurationKeys.USE_DATASET_LOCAL_WORK_DIR)) { Review comment: Same as above ########## File path: gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/writer/FileAwareInputStreamDataWriterBuilder.java ########## @@ -52,14 +53,13 @@ public synchronized static void setJobSpecificOutputPaths(State state) { // Other tasks may have set this already + // If reading from the sharded dataset path, writer directory paths are stored in the workunit state if (!StringUtils.containsIgnoreCase(state.getProp(ConfigurationKeys.WRITER_STAGING_DIR), - state.getProp(ConfigurationKeys.JOB_ID_KEY))) { - - state.setProp(ConfigurationKeys.WRITER_STAGING_DIR, new Path(state.getProp(ConfigurationKeys.WRITER_STAGING_DIR), - state.getProp(ConfigurationKeys.JOB_ID_KEY))); - state.setProp(ConfigurationKeys.WRITER_OUTPUT_DIR, new Path(state.getProp(ConfigurationKeys.WRITER_OUTPUT_DIR), - state.getProp(ConfigurationKeys.JOB_ID_KEY))); - + state.getProp(ConfigurationKeys.JOB_ID_KEY)) && !state.getPropAsBoolean(ConfigurationKeys.USE_DATASET_LOCAL_WORK_DIR)) { + state.setProp(ConfigurationKeys.WRITER_STAGING_DIR, new Path(state.getProp(ConfigurationKeys.WRITER_STAGING_DIR), Review comment: @Will-Lo If your concern is about hive-distcp user with shard configuration: It should be fine to move this into handler only since I don't think there's any real usage existed for shard-aware distcp ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
