[ARVADOS] created: 2.1.0-380-g1f82b6bdc
Git user
git at public.arvados.org
Thu Feb 4 02:44:42 UTC 2021
at 1f82b6bdcb305681a169a98589af9ba5adf3292c (commit)
commit 1f82b6bdcb305681a169a98589af9ba5adf3292c
Author: Ward Vandewege <ward at curii.com>
Date: Wed Feb 3 21:43:34 2021 -0500
17249: make costanalyzer report preemptible status of the instance in
the UUID report file.
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/lib/costanalyzer/costanalyzer.go b/lib/costanalyzer/costanalyzer.go
index e8dd18605..ecb0883fa 100644
--- a/lib/costanalyzer/costanalyzer.go
+++ b/lib/costanalyzer/costanalyzer.go
@@ -90,6 +90,12 @@ Usage:
was fulfilled. This program uses the cost data stored at the time of the
execution of the container, stored in the 'node.json' file in its log
collection.
+ - if a container was run on a preemptible ("spot") instance, the cost data
+ reported by this program may be wildly inaccurate, because it does not have
+ access to the spot pricing in effect for the node then the container ran. The
+ UUID report file that is generated when the '-output' option is specified has
+ a column that indicates the preemptible state of the instance that ran the
+ container.
In order to get the data for the uuids supplied, the ARVADOS_API_HOST and
ARVADOS_API_TOKEN environment variables must be set.
@@ -180,8 +186,12 @@ func addContainerLine(logger *logrus.Logger, node nodeInfo, cr arvados.Container
price = node.Price
size = node.ProviderType
}
+ var preemptible bool
+ if container.SchedulingParameters.Preemptible {
+ preemptible = true
+ }
cost = delta.Seconds() / 3600 * price
- csv += size + "," + strconv.FormatFloat(price, 'f', 8, 64) + "," + strconv.FormatFloat(cost, 'f', 8, 64) + "\n"
+ csv += size + "," + fmt.Sprintf("%+v", preemptible) + "," + strconv.FormatFloat(price, 'f', 8, 64) + "," + strconv.FormatFloat(cost, 'f', 8, 64) + "\n"
return
}
@@ -369,7 +379,7 @@ func generateCrCsv(logger *logrus.Logger, uuid string, arv *arvadosclient.Arvado
cost = make(map[string]float64)
- csv := "CR UUID,CR name,Container UUID,State,Started At,Finished At,Duration in seconds,Compute node type,Hourly node cost,Total cost\n"
+ csv := "CR UUID,CR name,Container UUID,State,Started At,Finished At,Duration in seconds,Compute node type,Preemptible,Hourly node cost,Total cost\n"
var tmpCsv string
var tmpTotalCost float64
var totalCost float64
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list