class CircleCI::Parallel::Node
Represents a CircleCI
node.
Attributes
build[R]
index[R]
Public Class Methods
new(build, index)
click to toggle source
@param build [Build] the build that the node belongs to @param index [Integer] node index (`CIRCLE_NODE_INDEX`)
# File lib/circleci/parallel/node.rb, line 9 def initialize(build, index) @build = build @index = index end
Public Instance Methods
==(other)
click to toggle source
# File lib/circleci/parallel/node.rb, line 14 def ==(other) build == other.build && index == other.index end
Also aliased as: eql?
data_dir()
click to toggle source
@return [String] the local data directory where node specific data should be saved in
@see CircleCI::Parallel.local_data_dir
# File lib/circleci/parallel/node.rb, line 40 def data_dir File.join(BASE_DATA_DIR, ssh_host) end
hash()
click to toggle source
# File lib/circleci/parallel/node.rb, line 20 def hash build.hash ^ index.hash end
master?()
click to toggle source
@return [Boolean] whether the node is the master node or not
# File lib/circleci/parallel/node.rb, line 25 def master? index.zero? end
other_nodes()
click to toggle source
@return [Array<Node>] other nodes of the same build
# File lib/circleci/parallel/node.rb, line 45 def other_nodes @other_nodes ||= (build.nodes - [self]).freeze end
ssh_host()
click to toggle source
@return [String] the hostname that can be used for `ssh` command to connect between nodes
# File lib/circleci/parallel/node.rb, line 30 def ssh_host # https://circleci.com/docs/ssh-between-build-containers/ "node#{index}" end
Also aliased as: name