Skip to content

Instantly share code, notes, and snippets.

@jmaher
Created July 2, 2020 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmaher/1b77b25928bcad397b978939828a1bb3 to your computer and use it in GitHub Desktop.
Save jmaher/1b77b25928bcad397b978939828a1bb3 to your computer and use it in GitHub Desktop.
--select data.date, data.project, count(distinct data.revision) as pushes, sum(data.cost) as cost, sum(data.cost)/count(distinct data.revision) as cost_per_push from (
select count(distinct data.revision) as pushes, sum(data.cost) as cost, sum(data.cost)/count(distinct data.revision) as cost_per_push from (
SELECT
DATE_TRUNC(dts.date, MONTH) as date,
dts.revision,
dts.project,
dts.workerType,
-- sum(cpw.cost) as cost
(sum(dts.execution)/3600)*(sum(cpw.cost)/sum(cpw.hours)) as cost
FROM
taskclusteretl.derived_task_summary as dts,
taskclusteretl.derived_daily_cost_per_workertype as cpw
WHERE
dts.date>='2020-04-01'
AND dts.date<'2020-07-01'
AND dts.project in ('autoland')
and symbol='B' and groupSymbol is NULL and kind='build' and collection='opt'
and (platform like 'linux64%' or platform like 'android-4-0-armv7-api16%' or platform like 'osx%' or platform like 'android-5-0-aarch64%' or platform like 'windows2012-32%' or platform like 'windows2012-64%')
AND dts.date=cpw.date
AND cpw.cluster='firefox'
AND cpw.hours is not null
AND cpw.workerType=dts.workerType
AND cpw.provisionerId=dts.provisionerId
GROUP BY
dts.date,
dts.project,
dts.revision,
dts.workerType
ORDER BY
dts.date,
dts.workerType
ASC
) as data
--group by data.date, data.project
--order by date asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment