hudson.model.Node.getRootPath()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(170)

本文整理了Java中hudson.model.Node.getRootPath()方法的一些代码示例,展示了Node.getRootPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getRootPath()方法的具体详情如下:
包路径:hudson.model.Node
类名称:Node
方法名:getRootPath

Node.getRootPath介绍

[英]Gets the root directory of this node.

Hudson always owns a directory on every node. This method returns that.
[中]获取此节点的根目录。
Hudson在每个节点上都拥有一个目录。这个方法返回。

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. public ZFSProvisioner(Node node) throws IOException, InterruptedException {
  2. rootDataset = node.getRootPath().act(new GetName());
  3. }
  4. private static class GetName extends MasterToSlaveFileCallable<String> {

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. protected Callable<DiskSpace, IOException> createCallable(Computer c) {
  3. Node node = c.getNode();
  4. if (node == null) return null;
  5. FilePath p = node.getRootPath();
  6. if(p==null) return null;
  7. return p.asCallableWith(new GetUsableSpace());
  8. }
  9. };

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. protected Callable<DiskSpace,IOException> createCallable(Computer c) {
  3. Node node = c.getNode();
  4. if (node == null) return null;
  5. FilePath p = node.getRootPath();
  6. if(p==null) return null;
  7. return p.asCallableWith(new GetTempSpace());
  8. }
  9. }

代码示例来源:origin: jenkinsci/jenkins

  1. public String getToolHome(Node node, ToolInstallation tool, TaskListener log) throws IOException, InterruptedException {
  2. if (node.getRootPath() == null) {
  3. log.error(node.getDisplayName() + " is offline; cannot locate " + tool.getName());
  4. return null;

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Convenience method to find a location to install a tool.
  3. * @param tool the tool being installed
  4. * @param node the computer on which to install the tool
  5. * @return {@link ToolInstallation#getHome} if specified, else a path within the local
  6. * Jenkins work area named according to {@link ToolInstallation#getName}
  7. * @since 1.310
  8. */
  9. protected final FilePath preferredLocation(ToolInstallation tool, Node node) {
  10. if (node == null) {
  11. throw new IllegalArgumentException("must pass non-null node");
  12. }
  13. String home = Util.fixEmptyAndTrim(tool.getHome());
  14. if (home == null) {
  15. home = sanitize(tool.getDescriptor().getId()) + File.separatorChar + sanitize(tool.getName());
  16. }
  17. FilePath root = node.getRootPath();
  18. if (root == null) {
  19. throw new IllegalArgumentException("Node " + node.getDisplayName() + " seems to be offline");
  20. }
  21. return root.child("tools").child(home);
  22. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. public ZFSProvisioner(Node node) throws IOException, InterruptedException {
  2. rootDataset = node.getRootPath().act(new MasterToSlaveFileCallable<String>() {
  3. private static final long serialVersionUID = -2142349338699797436L;
  4. public String invoke(File f, VirtualChannel channel) throws IOException {
  5. ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f);
  6. if(fs!=null) return fs.getName();
  7. // TODO: for now, only support agents that are already on ZFS.
  8. throw new IOException("Not on ZFS");
  9. }
  10. });
  11. }

代码示例来源:origin: org.jenkins-ci.lib/xtrigger-lib

  1. private boolean eligibleNode(Node node) {
  2. if (node == null) {
  3. return false;
  4. }
  5. if (node.getRootPath() == null) {
  6. return false;
  7. }
  8. return node.getNumExecutors() != 0;
  9. }

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

  1. public ZFSProvisioner(Node node) throws IOException, InterruptedException {
  2. this.node = node;
  3. rootDataset = node.getRootPath().act(new FileCallable<String>() {
  4. public String invoke(File f, VirtualChannel channel) throws IOException {
  5. ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f);
  6. if(fs!=null) return fs.getName();
  7. // TODO: for now, only support slaves that are already on ZFS.
  8. throw new IOException("Not on ZFS");
  9. }
  10. });
  11. }

代码示例来源:origin: hudson/hudson-2.x

  1. public ZFSProvisioner(Node node) throws IOException, InterruptedException {
  2. this.node = node;
  3. rootDataset = node.getRootPath().act(new FileCallable<String>() {
  4. public String invoke(File f, VirtualChannel channel) throws IOException {
  5. ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f);
  6. if(fs!=null) return fs.getName();
  7. // TODO: for now, only support slaves that are already on ZFS.
  8. throw new IOException("Not on ZFS");
  9. }
  10. });
  11. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. @Override
  2. protected Callable<DiskSpace,IOException> createCallable(Computer c) {
  3. Node node = c.getNode();
  4. if (node == null) return null;
  5. FilePath p = node.getRootPath();
  6. if(p==null) return null;
  7. return p.asCallableWith(new GetTempSpace());
  8. }
  9. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. @Override
  2. protected Callable<DiskSpace, IOException> createCallable(Computer c) {
  3. Node node = c.getNode();
  4. if (node == null) return null;
  5. FilePath p = node.getRootPath();
  6. if(p==null) return null;
  7. return p.asCallableWith(new GetUsableSpace());
  8. }
  9. };

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

  1. protected DiskSpace getFreeSpace(Computer c) throws IOException, InterruptedException {
  2. FilePath p = c.getNode().getRootPath();
  3. if(p==null) return null;
  4. return p.act(new GetUsableSpace());
  5. }
  6. };

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

  1. protected DiskSpace getFreeSpace(Computer c) throws IOException, InterruptedException {
  2. FilePath p = c.getNode().getRootPath();
  3. if(p==null) return null;
  4. return p.act(new GetTempSpace());
  5. }
  6. };

代码示例来源:origin: hudson/hudson-2.x

  1. protected DiskSpace getFreeSpace(Computer c) throws IOException, InterruptedException {
  2. FilePath p = c.getNode().getRootPath();
  3. if(p==null) return null;
  4. return p.act(new GetUsableSpace());
  5. }
  6. };

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

  1. @Override
  2. protected Lease decideWorkspace(Node n, WorkspaceList wsl) throws IOException, InterruptedException {
  3. String customWorkspace = getProject().getCustomWorkspace();
  4. if (customWorkspace != null) {
  5. // we allow custom workspaces to be concurrently used between jobs.
  6. return Lease.createDummyLease(n.getRootPath().child(getEnvironment(listener).expand(customWorkspace)));
  7. }
  8. return super.decideWorkspace(n, wsl);
  9. }

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

  1. @Override
  2. protected Lease decideWorkspace(Node n, WorkspaceList wsl) throws IOException, InterruptedException {
  3. String customWorkspace = getProject().getCustomWorkspace();
  4. if (customWorkspace != null)
  5. // we allow custom workspaces to be concurrently used between jobs.
  6. return Lease.createDummyLease(n.getRootPath().child(getEnvironment(listener).expand(customWorkspace)));
  7. return super.decideWorkspace(n,wsl);
  8. }
  9. }

代码示例来源:origin: org.eclipse.hudson/hudson-core

  1. @Override
  2. protected Lease decideWorkspace(Node n, WorkspaceList wsl) throws IOException, InterruptedException {
  3. String customWorkspace = getProject().getCustomWorkspace();
  4. if (customWorkspace != null) {
  5. // we allow custom workspaces to be concurrently used between jobs.
  6. return Lease.createDummyLease(n.getRootPath().child(getEnvironment(listener).expand(customWorkspace)));
  7. }
  8. return super.decideWorkspace(n, wsl);
  9. }
  10. }

代码示例来源:origin: hudson/hudson-2.x

  1. @Override
  2. protected Lease decideWorkspace(Node n, WorkspaceList wsl) throws IOException, InterruptedException {
  3. String customWorkspace = getProject().getCustomWorkspace();
  4. if (customWorkspace != null) {
  5. // we allow custom workspaces to be concurrently used between jobs.
  6. return Lease.createDummyLease(n.getRootPath().child(getEnvironment(listener).expand(customWorkspace)));
  7. }
  8. return super.decideWorkspace(n, wsl);
  9. }

代码示例来源:origin: hudson/hudson-2.x

  1. @Override
  2. protected Lease decideWorkspace(Node n, WorkspaceList wsl) throws IOException, InterruptedException {
  3. String customWorkspace = getProject().getCustomWorkspace();
  4. if (customWorkspace != null)
  5. // we allow custom workspaces to be concurrently used between jobs.
  6. return Lease.createDummyLease(n.getRootPath().child(getEnvironment(listener).expand(customWorkspace)));
  7. return super.decideWorkspace(n,wsl);
  8. }
  9. }

代码示例来源:origin: groupon/DotCi

  1. protected Lease getParentWorkspaceLease(final Node n, final WorkspaceList wsl) throws InterruptedException, IOException {
  2. final DynamicProject mp = getParent().getParent();
  3. final String customWorkspace = mp.getCustomWorkspace();
  4. if (customWorkspace != null) {
  5. // we allow custom workspaces to be concurrently used between
  6. // jobs.
  7. return Lease.createDummyLease(n.getRootPath().child(getEnvironment(this.listener).expand(customWorkspace)));
  8. }
  9. return wsl.allocate(n.getWorkspaceFor(mp), getParentBuild());
  10. }

相关文章