/** * @param ggfs Source GGFS. * @return Data transfer object for given GGFS. * @throws GridException */ public static VisorGgfs from(GridGgfs ggfs) throws GridException { assert ggfs != null; return new VisorGgfs( ggfs.name(), ggfs.configuration().getDefaultMode(), VisorGgfsMetrics.from(ggfs.metrics()), ggfs.configuration().getSecondaryFileSystem() != null ); }
/** {@inheritDoc} */ @Override protected Void run(String ggfsName) throws GridException { try { g.ggfs(ggfsName).format().get(); } catch (IllegalArgumentException iae) { throw new GridException("Failed to format GGFS: " + ggfsName, iae); } return null; }
/** {@inheritDoc} */ @Override protected Void run(Set<String> ggfsNames) throws GridException { for (String ggfsName: ggfsNames) try { g.ggfs(ggfsName).resetMetrics(); } catch (IllegalArgumentException iae) { throw new GridException("Failed to reset metrics for GGFS: " + ggfsName, iae); } return null; }
@Nullable @Override public GridBiTuple<Long, Long> execute() throws GridException { GridGgfs ggfs = ((GridKernal)g).context().ggfs().ggfs(ggfsName); if (ggfs == null) return F.t(0L, 0L); GridGgfsMetrics metrics = ggfs.metrics(); long loc = metrics.localSpaceSize(); return F.t(loc, metrics.maxSpaceSize()); } });
/** {@inheritDoc} */ @Override public Object execute() throws GridException { GridGgfs ggfs = grid.ggfs(ggfsName); try (GridGgfsInputStream in = ggfs.open(path)) { GridGgfsFileRange split = new GridGgfsFileRange(path, start, len); if (rslvr != null) { split = rslvr.resolveRecords(ggfs, in, split); if (split == null) { log.warning("No data found for split on local node after resolver is applied " + "[ggfsName=" + ggfsName + ", path=" + path + ", start=" + start + ", len=" + len + ']'); return null; } } in.seek(split.start()); return job.execute(ggfs, new GridGgfsFileRange(path, split.start(), split.length()), in); } catch (IOException e) { throw new GridException("Failed to execute GGFS job for file split [ggfsName=" + ggfsName + ", path=" + path + ", start=" + start + ", len=" + len + ']', e); } }
/** Collect GGFS. */ private void ggfs(VisorDataCollectorJobResult res) { try { GridGgfsProcessorAdapter ggfsProc = ((GridKernal)g).context().ggfs(); for (GridGgfs ggfs : ggfsProc.ggfss()) { long start0 = U.currentTimeMillis(); try { Collection<GridIpcServerEndpoint> endPoints = ggfsProc.endpoints(ggfs.name()); if (endPoints != null) { for (GridIpcServerEndpoint ep : endPoints) if (ep.isManagement()) res.ggfsEndpoints.add(new VisorGgfsEndpoint(ggfs.name(), g.name(), ep.getHost(), ep.getPort())); } res.ggfss.add(VisorGgfs.from(ggfs)); } finally { if (debug) log(g.log(), "Collected GGFS: " + ggfs.name(), getClass(), start0); } } } catch(Throwable ggfssEx) { res.ggfssEx = ggfssEx; } }
@Nullable @Override public GridBiTuple<Long, Long> execute() throws GridException { GridGgfs ggfs = ((GridKernal)g).context().ggfs().ggfs(ggfsName); if (ggfs == null) return F.t(0L, 0L); GridGgfsMetrics metrics = ggfs.metrics(); long loc = metrics.localSpaceSize(); return F.t(loc, metrics.maxSpaceSize()); } });
/** {@inheritDoc} */ @Override public Object execute() throws GridException { GridGgfs ggfs = grid.ggfs(ggfsName); try (GridGgfsInputStream in = ggfs.open(path)) { GridGgfsFileRange split = new GridGgfsFileRange(path, start, len); if (rslvr != null) { split = rslvr.resolveRecords(ggfs, in, split); if (split == null) { log.warning("No data found for split on local node after resolver is applied " + "[ggfsName=" + ggfsName + ", path=" + path + ", start=" + start + ", len=" + len + ']'); return null; } } in.seek(split.start()); return job.execute(ggfs, new GridGgfsFileRange(path, split.start(), split.length()), in); } catch (IOException e) { throw new GridException("Failed to execute GGFS job for file split [ggfsName=" + ggfsName + ", path=" + path + ", start=" + start + ", len=" + len + ']', e); } }