078 improvements
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
<cfset hours=dateDiff('h', dt_start, dateAdd('d', 1, dt_finish))/>
|
||||
<cfparam name="only_articles_in_spec" type="boolean" default=false/>
|
||||
<cfparam name="wz" default=""/>
|
||||
<cfparam name="code" default=""/>
|
||||
|
||||
<!--- *** коды лучше взять из каталога --->
|
||||
<cfquery name="qCode" datasource="dwh" cachedWithin=#createTimeSpan(0, 0, 20, 0)#>
|
||||
@@ -89,6 +90,9 @@
|
||||
AND p.cnt <> 0 --похоже, только так можно отфильтровать паразитные строки с нулем
|
||||
<cfif len(wz)>
|
||||
AND k.id_klienta like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#wz#%"/>
|
||||
</cfif>
|
||||
<cfif len(code)>
|
||||
AND p.code like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
--AND k.id_klienta='WZ01031'
|
||||
--AND k.id_klienta='WZ01112'
|
||||
@@ -329,33 +333,112 @@ select
|
||||
<cfoutput>qS3OpsTrfAge:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--- выданы права на схему и таблицы, чтобы без толку не плодить источники данных --->
|
||||
<!--- считаются часы работы ВМ с GPU --->
|
||||
<cfquery name="qGpu" datasource="billing-vc" cachedWithin=#createTimeSpan(0, 0, 31, 0)#>
|
||||
WITH card (model, cluster, code) as (VALUES
|
||||
('A100', 'msk1-pub02-i31', 'iaas.ngc.i31.gpu80'),
|
||||
('H100', 'msk1-pub07-a40', 'iaas.ngc.a40.gpuh100'), -- h200 нет в отчете
|
||||
('RTX 4090', 'msk1-pcs05-a45', 'iaas.ngc.a45.gpu4090'), -- нет такого в каталоге
|
||||
('RTX 5090', 'msk1-pcs05-a45', 'iaas.ngc.a45.gpu5090'),
|
||||
('RTX 6000', 'msk1-pub07-a40', 'iaas.ngc.a40.gpu6k'),
|
||||
('nvidia_a16-16q', 'msk1-pub07-a40', 'iaas.ngc.a40.gpu16'),
|
||||
('nvidia_a16-16q', 'msk1-pub01-i29', 'iaas.ngc.i29.gpu16'),
|
||||
('nvidia_a16-1b', 'msk1-pub07-a40', 'iaas.ngc.a40.gpu1'),
|
||||
('nvidia_a16-2q', 'msk1-pub07-a40', 'iaas.ngc.a40.gpu2'),
|
||||
('nvidia_a16-4q', 'msk1-pub07-a40', 'iaas.ngc.a40.gpu4'),
|
||||
('nvidia_rtx_pro_6000_blackwell_dc-4q', 'msk1-pub07-a40', 'iaas.ngc.a40.gpu6k4')
|
||||
)
|
||||
SELECT item.key AS gpu_model, c.code
|
||||
,SUM(item.value::int*p.value)/12. AS gpu_h -- 5 minute sampling
|
||||
,vm.obj_id, upper(trim(vm.client_id)) as WZ
|
||||
FROM gpu.vm
|
||||
CROSS JOIN LATERAL jsonb_each(vm.gpu) AS item(key, value)
|
||||
LEFT OUTER JOIN card c ON (item.key=c.model)
|
||||
JOIN gpu.vm_power_state p ON (vm.obj_uuid=p.obj_uuid)
|
||||
WHERE NOT vm.is_template
|
||||
AND p.ts >= <cfqueryparam cfsqltype="cf_sql_timestamp" value=#dt_start#/>
|
||||
AND p.ts < <cfqueryparam cfsqltype="cf_sql_timestamp" value=#dateAdd("d",1,dt_finish)#/>
|
||||
GROUP BY vm.client_id, item.key, c.code, vm.obj_id
|
||||
ORDER BY vm.client_id, item.key, c.code, vm.obj_id;
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>qGpu:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
|
||||
<cfif isDefined("DEBUG")>
|
||||
<cfdump var=#qGpu#/>
|
||||
<cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
</cfif>
|
||||
|
||||
<cfquery name="qGpuAge" datasource="billing-vc" cachedWithin=#createTimeSpan(0, 0, 31, 0)#>
|
||||
select max(dt_load) as dt_load from gpu.vm
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>qGpuAge:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<cfquery name="qUnifiedMetric" dbType="query">
|
||||
select wz, code || '.vcpu' as code, core_h as raw_metric, core_h as metric, 'core-h' as unit, vdc as dimension1
|
||||
from qComputing
|
||||
<cfif len(code)>
|
||||
where code || '.vcpu' like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
union all
|
||||
select wz, code || '.ram', gb_h as raw_metric, gb_h as metric, 'GByte-h' as unit, vdc as dimension1
|
||||
from qComputing
|
||||
<cfif len(code)>
|
||||
where code || '.ram' like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
union all
|
||||
select wz, code, gb_m_used as raw_metric, gb_m_used as metric, 'GByte-m' as unit, vdc ||':'|| profile as dimension1
|
||||
from qStorage
|
||||
<cfif len(code)>
|
||||
where code like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
union all
|
||||
select wz, code || '.vol', vol_b as raw_metric, vol_gb as metric, 'GByte-m' as unit, bucket as dimension1
|
||||
from qS3Vol
|
||||
<cfif len(code)>
|
||||
where code || '.vol' like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
union all
|
||||
select wz, code || '.get', get as raw_metric, get_10k as metric, '10k' as unit, bucket as dimension1
|
||||
select wz, code || '.vol', get as raw_metric, get_10k as metric, '10k' as unit, bucket as dimension1
|
||||
from qS3OpsTrf
|
||||
<cfif len(code)>
|
||||
where code || '.vol' like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
union all
|
||||
select wz, code || '.put', put as raw_metric, put_10k as metric, '10k' as unit, bucket as dimension1
|
||||
from qS3OpsTrf
|
||||
<cfif len(code)>
|
||||
where code || '.put' like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
union all
|
||||
select wz, code || '.trf', bytes_sent as raw_metric, bytes_sent_gb as metric, 'GByte' as unit, bucket as dimension1
|
||||
from qS3OpsTrf
|
||||
<cfif len(code)>
|
||||
where code || '.trf' like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
union all
|
||||
select wz, code, gpu_h as raw_metric, gpu_h as metric, 'h' as unit, obj_id as dimension1
|
||||
from qGpu
|
||||
<cfif len(code)>
|
||||
where code like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
order by wz, code
|
||||
</cfquery>
|
||||
@@ -499,7 +582,8 @@ ORDER BY coalesce(coalesce(c.wz, m.wz), s.wz), coalesce(s.code, m.code)
|
||||
Период с <input type="text" name="dt_start" value="#dateFormat(dt_start,'YYYY-MM-DD')#"/>
|
||||
по <input type="text" name="dt_finish" value="#dateFormat(dt_finish,'YYYY-MM-DD')#"/>
|
||||
Только PAYG <input type="checkbox" name="only_articles_in_spec" value="1"<cfif only_articles_in_spec> checked</cfif>/>
|
||||
WZ <input type="text" name="wz" value="#wz#"/> по вхождению подстроки, с учетом регистра
|
||||
WZ <input type="text" name="wz" value="#wz#"/>по вхождению, с регистром
|
||||
Код <input type="text" name="code" value="#code#"/>>по вхождению
|
||||
<input type="submit" style="cursor:pointer;"/>
|
||||
<input type="submit" name="DEBUG" value="DEBUG" style="cursor:pointer;"/>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user