100 aillm first try
This commit is contained in:
+1
-1
@@ -89,7 +89,7 @@
|
||||
|
||||
<!--- global settings --->
|
||||
<!--- *************************************************************************************************** --->
|
||||
<cfset request.APP_VERSION="0.00.099"/> <!--- *********************************************************** --->
|
||||
<cfset request.APP_VERSION="0.00.100"/> <!--- *********************************************************** --->
|
||||
<!--- *************************************************************************************************** --->
|
||||
<cfset request.STAND=getStand()/>
|
||||
<cfset request.RECORDS_PER_PAGE=500/>
|
||||
|
||||
@@ -390,7 +390,7 @@ select
|
||||
<cfoutput>qS3OpsTrfAge:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
|
||||
<!--- /*прибегаем к cmdb для разрешения инстанса, нейминг некорректен и ненадежен*/ --->
|
||||
<cfquery name="qS3User" datasource="cmdb" cachedWithin=#createTimeSpan(0, 0, 31, 0)#>
|
||||
<cfquery name="qS3User" datasource="cmdb" cachedWithin=#createTimeSpan(0, 0, 32, 0)#>
|
||||
WITH current_state AS (
|
||||
SELECT *, ROW_NUMBER() OVER (PARTITION BY instance_uid ORDER BY version DESC) as rn
|
||||
FROM instance_state
|
||||
@@ -410,7 +410,7 @@ select
|
||||
|
||||
<!--- выданы права на схему и таблицы, чтобы без толку не плодить источники данных --->
|
||||
<!--- считаются часы работы ВМ с GPU --->
|
||||
<cfquery name="qGpu" datasource="billing-vc" cachedWithin=#createTimeSpan(0, 0, 31, 0)#>
|
||||
<cfquery name="qGpu" datasource="billing-vc" cachedWithin=#createTimeSpan(0, 0, 33, 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 нет в отчете
|
||||
@@ -443,6 +443,7 @@ select
|
||||
|
||||
<cfoutput>qGpu:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
|
||||
|
||||
<cfif len(debug)>
|
||||
<cfdump var=#qGpu#/>
|
||||
<cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
@@ -454,13 +455,66 @@ select
|
||||
|
||||
<cfoutput>qGpuAge:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
|
||||
|
||||
<cfquery name="qLlm" datasource="billing-vc" cachedWithin=#createTimeSpan(0, 0, 33, 0)#>
|
||||
WITH cred as (
|
||||
SELECT
|
||||
column1::varchar(255) as model_name,
|
||||
column2::decimal(10,6) as weight_in,
|
||||
column3::decimal(10,6) as weight_out,
|
||||
column4::decimal(10,6) as weight_cached,
|
||||
column5::decimal(10,6) as weight_audio_sec
|
||||
FROM
|
||||
(VALUES
|
||||
('qwen3.8-27b-fp8', 0.329400, 2.196000, null, null),
|
||||
('gpt-oss-120b', 0.242000, 0.980000, null, null),
|
||||
('user-bge-m3', 0.006000, null, null, null),
|
||||
('bge-reranker-v2-m3', 0.002400, null, null, null),
|
||||
('whisper-large-v3-turbo', null, null, null, 0.006500)
|
||||
)
|
||||
)
|
||||
SELECT m.organization_name, m.model_name
|
||||
,SUM(m.prompt_tokens) as tokens_in
|
||||
,SUM(m.completion_tokens) as tokens_out
|
||||
,SUM(m.cached_tokens) as tokens_cached
|
||||
,SUM(m.audio_seconds) as audio_seconds
|
||||
,SUM(m.prompt_tokens)*c.weight_in/1e6 as cred_in
|
||||
,SUM(m.completion_tokens)*c.weight_out/1e6 as cred_out
|
||||
,SUM(m.cached_tokens)*c.weight_cached/1e6 as cred_cached
|
||||
,SUM(m.audio_seconds)*c.weight_audio_sec/60e6 as cred_audio_minutes
|
||||
FROM aillm.usage_metric m join cred c on (m.model_name=c.model_name)
|
||||
WHERE 1=1
|
||||
AND m.interval_start >= <cfqueryparam cfsqltype="cf_sql_timestamp" value=#dt_start#/>
|
||||
AND m.interval_start < <cfqueryparam cfsqltype="cf_sql_timestamp" value=#dateAdd("d",1,dt_finish)#/> <!--- *** может быть, краевое уточнение для 15 мин --->
|
||||
<cfif len(wz)>
|
||||
AND m.organization_name ilike <cfqueryparam cfsqltype="cf_sql_varchar" value="%#wz#%"/>
|
||||
</cfif>
|
||||
GROUP BY m.organization_id, m.organization_name, m.model_name, c.weight_in, c.weight_out, c.weight_cached, c.weight_audio_sec
|
||||
ORDER BY m.organization_id, m.organization_name, m.model_name;
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>qLlm:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
<cfif len(debug)>
|
||||
<cfdump var=#qLlm#/>
|
||||
<cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
</cfif>
|
||||
|
||||
<cfquery name="qLlmAge" datasource="billing-vc" cachedWithin=#createTimeSpan(0, 0, 31, 0)#>
|
||||
select max(ts) as dt_load from aillm.usage_metric
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>qLlmAge:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
|
||||
|
||||
|
||||
<cfset db = new MemoryDbHelper()/>
|
||||
<cfset db.register("qComputing", qComputing, "inmem")/>
|
||||
<cfset db.register("qStorage", qStorage, "inmem")/>
|
||||
<cfset db.register("qS3Vol", qS3Vol, "inmem")/>
|
||||
<cfset db.register("qS3OpsTrf", qS3OpsTrf, "inmem")/>
|
||||
<cfset db.register("qGpu", qGpu, "inmem")/>
|
||||
<cfset db.register("qS3User", qS3User, "inmem")/>
|
||||
<cfset db.register("qGpu", qGpu, "inmem")/>
|
||||
<cfset db.register("qLlm", qLlm, "inmem")/>
|
||||
|
||||
<cfquery name="qUnifiedMetric" datasource="inmem">
|
||||
select wz, code || '.vcpu' as code, core_h as raw_metric, core_h as metric, 'core-h' as unit, vdc as dimension1
|
||||
@@ -522,6 +576,34 @@ select
|
||||
where code like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
union all
|
||||
select organization_name as wz, 'tokens_in', tokens_in as raw_metric, cred_in as metric, 'cred' as unit, model_name as dimension1
|
||||
from qLlm
|
||||
<cfif len(code)>
|
||||
where 'tokens_in' like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
union all
|
||||
select organization_name as wz, 'tokens_out', tokens_out as raw_metric, cred_out as metric, 'cred' as unit, model_name as dimension1
|
||||
from qLlm
|
||||
<cfif len(code)>
|
||||
where 'tokens_out' like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
union all
|
||||
select organization_name as wz, 'tokens_cached', tokens_cached as raw_metric, cred_cached as metric, 'cred' as unit, model_name as dimension1
|
||||
from qLlm
|
||||
<cfif len(code)>
|
||||
where 'tokens_cached' like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
union all
|
||||
select organization_name as wz, 'audio_minutes', audio_seconds as raw_metric, cred_audio_minutes as metric, 'cred' as unit, model_name as dimension1
|
||||
from qLlm
|
||||
<cfif len(code)>
|
||||
where 'audio_minutes' like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
|
||||
order by wz, code
|
||||
</cfquery>
|
||||
<!--- <cfdump var=#qSpec#/>
|
||||
@@ -753,14 +835,14 @@ WZ <input type="text" name="wz" value="#wz#"/>по вхождению, с рег
|
||||
</form>
|
||||
Часов в периоде: <b>#hours#</b> Строк в отчете: <b>#qCharge.recordCount#</b><br/>
|
||||
Актуальность данных:
|
||||
VCD Computing: <b<cfif datediff("h",qComputingAge.dt_load, Now()) GT 24> class="err"</cfif>>#dateFormat(qComputingAge.dt_load,'YYYY-MM-DD')# #timeFormat(qComputingAge.dt_load,'HH:mm:ss.lXX')#</b>
|
||||
VCD Storage: <b<cfif datediff("h",qStorageAge.dt_load, Now()) GT 24> class="err"</cfif>>#dateFormat(qStorageAge.dt_load,'YYYY-MM-DD')# #timeFormat(qStorageAge.dt_load,'HH:mm:ss.lXX')#</b>
|
||||
S3 хранение: <b<cfif datediff("h",qS3VolAge.dt_load, Now()) GT 24> class="err"</cfif>>#dateFormat(qS3VolAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3VolAge.dt_load,'HH:mm:ss.lXX')#</b>
|
||||
S3 операции и трафик: <b<cfif datediff("h",qS3OpsTrfAge.dt_load, Now()) GT 24> class="err"</cfif>>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3OpsTrfAge.dt_load,'HH:mm:ss.lXX')#</b>
|
||||
VCD Computing: <b<cfif datediff("h",qComputingAge.dt_load, Now()) GT 24> class="err"</cfif>>#dateFormat(qComputingAge.dt_load,'YYYY-MM-DD')# #timeFormat(qComputingAge.dt_load,'HH:mm:ssX')#</b>
|
||||
VCD Storage: <b<cfif datediff("h",qStorageAge.dt_load, Now()) GT 24> class="err"</cfif>>#dateFormat(qStorageAge.dt_load,'YYYY-MM-DD')# #timeFormat(qStorageAge.dt_load,'HH:mm:ssX')#</b>
|
||||
S3 хранение: <b<cfif datediff("h",qS3VolAge.dt_load, Now()) GT 24> class="err"</cfif>>#dateFormat(qS3VolAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3VolAge.dt_load,'HH:mm:ssX')#</b>
|
||||
S3 операции и трафик: <b<cfif datediff("h",qS3OpsTrfAge.dt_load, Now()) GT 24> class="err"</cfif>>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3OpsTrfAge.dt_load,'HH:mm:ssX')#</b>
|
||||
GPU: <b<cfif datediff("h",qGpuAge.dt_load, Now()) GT 24> class="err"</cfif>>#dateFormat(qGpuAge.dt_load,'YYYY-MM-DD')# #timeFormat(qGpuAge.dt_load,'HH:mm:ssX')#</b>
|
||||
LLM: <b<cfif datediff("h",qLlmAge.dt_load, Now()) GT 24> class="err"</cfif>>#dateFormat(qLlmAge.dt_load,'YYYY-MM-DD')# #timeFormat(qLlmAge.dt_load,'HH:mm:ssX')#</b>
|
||||
|
||||
<br/>
|
||||
<!--- <a href="#request.thisPage#?output_xls" title="экспорт в Excel" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/xls.gif" style="vertical-align:text-bottom;"/></a>
|
||||
<a href="#request.thisPage#?output_json" title="экспорт в json" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/json.svg" style="vertical-align:text-bottom;" width="13" height="13"/></a> --->
|
||||
|
||||
<a href="#request.thisPage#?output_xls&submit=1&dt_start=#dateFormat(dt_start,'YYYY-MM-DD')#&dt_finish=#dateFormat(dt_finish,'YYYY-MM-DD')#&inner_join=#inner_join#&only_articles_in_spec=#only_articles_in_spec#&code=#code#&wz=#wz#" title="экспорт в Excel" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/xls.gif" style="vertical-align:text-bottom;"/></a>
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
cross join (select max(timestamp_addition) as timestamp_addition from s3billing.bucket_stat) t
|
||||
</cfquery>
|
||||
|
||||
<cfquery name="qS3User" datasource="cmdb" cachedWithin=#createTimeSpan(0, 0, 31, 0)#>
|
||||
<cfquery name="qS3User" datasource="cmdb" cachedWithin=#createTimeSpan(0, 0, 1, 0)#>
|
||||
WITH current_state AS (
|
||||
SELECT *, ROW_NUMBER() OVER (PARTITION BY instance_uid ORDER BY version DESC) as rn
|
||||
FROM instance_state
|
||||
|
||||
Reference in New Issue
Block a user