Merge branch 'master' into 7478-s-preemptable-preemptible
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Tue, 19 Jun 2018 18:31:24 +0000 (15:31 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Tue, 19 Jun 2018 18:31:24 +0000 (15:31 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

1  2 
sdk/go/arvados/config.go

index 9c684bbe3ef32b09b96efff7389ce72d3a4f53d8,841f95281e01a5ee7fd70e92832ea24f642799f4..182cf8433b2ef0152381b7b7b0acab263685e807
@@@ -62,24 -63,22 +63,22 @@@ type InstanceType struct 
        RAM          int64
        Scratch      int64
        Price        float64
 -      Preemptable  bool
 +      Preemptible  bool
  }
  
- // GetThisSystemNode returns a SystemNode for the node we're running
- // on right now.
- func (cc *Cluster) GetThisSystemNode() (*SystemNode, error) {
-       hostname, err := os.Hostname()
-       if err != nil {
-               return nil, err
+ // GetNodeProfile returns a NodeProfile for the given hostname. An
+ // error is returned if the appropriate configuration can't be
+ // determined (e.g., this does not appear to be a system node). If
+ // node is empty, use the OS-reported hostname.
+ func (cc *Cluster) GetNodeProfile(node string) (*NodeProfile, error) {
+       if node == "" {
+               hostname, err := os.Hostname()
+               if err != nil {
+                       return nil, err
+               }
+               node = hostname
        }
-       return cc.GetSystemNode(hostname)
- }
- // GetSystemNode returns a SystemNode for the given hostname. An error
- // is returned if the appropriate configuration can't be determined
- // (e.g., this does not appear to be a system node).
- func (cc *Cluster) GetSystemNode(node string) (*SystemNode, error) {
-       if cfg, ok := cc.SystemNodes[node]; ok {
+       if cfg, ok := cc.NodeProfiles[node]; ok {
                return &cfg, nil
        }
        // If node is not listed, but "*" gives a default system node