ExportXMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • 9.1.0-rc0, 9.1.0-rc1026
    • Affects Version/s: None
    • Component/s: Bazel
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Stacked on #67359 (the base branch of this PR), which makes the RBE result tasks Evergreen virtual tasks. Retarget to master once that merges.

      Evergreen now accepts a cost estimate with the push-completion of a virtual task (evergreen-ci/evergreen#11040) and records it as the task's EngFlow cost, which also rolls up into the version's cost. This sends that estimate for every resmoke suite, so the remote execution spend shows up next to each result task instead of only in the resmoke_tests log.

      What it does

      • buildscripts/virtual_result_tasks.py: stage_target prices the target and _completion adds estimated_cost_usd, worker_hours and rate_usd_per_worker_hour to the completion's external_metadata, for both the REST push and the virtual_tasks.complete file of targets held back with cores.
      • buildscripts/engflow_invocation_cost.py: new target_cost_from_bep estimates a target's spend from build_events.json alone. It sums setupTime + executionWallTime + uploadTime of the target's remotely executed test attempts (all shards and retries), and multiplies by the vCPUs of the target's pool and the existing blended rate (SPOT_USD_PER_VCPU_HOUR, ON_DEMAND_USD_PER_VCPU_HOUR, SPOT_FRACTION). The pool comes from the target's testSize and the cpu of its configuration via the new TEST_POOLS, which mirrors bazel/test_exec_properties.bzl.

      Why the BEP and not EngFlow's profile

      A virtual task can only be given its cost when it is completed, which happens while the invocation is still running. EngFlow's profile is per invocation, tens of megabytes for a full run, and lags behind the last-finished actions. The BEP timings are available as soon as the target's testSummary arrives and agree with the profile: for the three suites of a real run the two differ by 0.1% to 2% (722.6s vs 724.6s, 968.4s vs 969.2s, 32.5s vs 33.2s of worker time).

      Safety

      • Best-effort: a failure to price a target is logged and the completion is sent without cost fields. A target whose pool cannot be determined is sent without cost fields rather than with a guess.
      • Cache hits and locally executed attempts are priced at zero.
      • StagedTarget.engflow_cost defaults to empty, so a staged.json written before this change still loads.

      Not covered

      • The runner's pre-build and the handful of non-test remote actions are not attributed to any result task. Evergreen only takes this cost on push-completed virtual tasks, so the resmoke_tests task itself still only logs its total.
      • A result task that is restarted runs on a host as a regular task and is costed by Evergreen as such.

      Testing

      • bazel test //buildscripts/tests:test_engflow_invocation_cost //buildscripts/tests:test_virtual_result_tasks //buildscripts/tests:test_stream_result_task_activation
      • Ran target_cost_from_bep against the build_events.json of a finished resmoke_tests task and compared it with EngFlow's profile of the same invocation (figures above).

            Assignee:
            Zack Winter
            Reporter:
            Zack Winter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: