@Override public void close() throws Exception { spillService.deleteSpillSubdirs(id); }
public SpillFile getSpillFile(String fileName) throws RuntimeException { try { final SpillDirectory spillDirectory = spillService.getSpillSubdir(id); return new SpillFile(spillDirectory.getFileSystem(), new Path(spillDirectory.getSpillDirPath(), fileName)); } catch (UserException e) { throw UserException.dataWriteError(e) .addContext("for %s spill id %s", caller, id) .addContext("Caller", caller) .build(logger); } }
public SpillManager(SabotConfig sabotConfig, OptionManager optionManager, String id, Configuration hadoopConf, SpillService spillService, String caller) { final List<String> directories = new ArrayList<>(sabotConfig.getStringList(ExecConstants.SPILL_DIRS)); if (directories.isEmpty()) { throw UserException.dataWriteError().message("No spill locations specified.").build(logger); } this.id = id; this.caller = caller; this.hadoopConf = hadoopConf; this.spillService = spillService; // load options if (optionManager != null) { this.minDiskSpacePercentage = optionManager.getOption(ExecConstants.SPILL_DISK_SPACE_LIMIT_PERCENTAGE); this.minDiskSpace = optionManager.getOption(ExecConstants.SPILL_DISK_SPACE_LIMIT_BYTES); this.healthCheckInterval = optionManager.getOption(ExecConstants.SPILL_DISK_SPACE_CHECK_INTERVAL); } else { this.minDiskSpacePercentage = ExecConstants.SPILL_DISK_SPACE_LIMIT_PERCENTAGE.getDefault().getFloatVal(); this.minDiskSpace = ExecConstants.SPILL_DISK_SPACE_LIMIT_BYTES.getDefault().getNumVal(); this.healthCheckInterval = ExecConstants.SPILL_DISK_SPACE_CHECK_INTERVAL.getDefault().getNumVal(); } try { spillService.makeSpillSubdirs(id); } catch (UserException e) { throw UserException.dataWriteError(e) .addContext("Caller", caller) .build(logger); } }
return spillDirectory; }).when(spillService).getSpillSubdir(any(String.class));
return spillDirectory; }).when(spillService).getSpillSubdir(any(String.class));