From 0d73d7e9104e3b42dedc50787ddfb2eb7ca1f09d Mon Sep 17 00:00:00 2001 From: nomennescio Date: Thu, 2 May 2024 22:42:22 +0100 Subject: [PATCH] Remove filtering on timestamps and use short ISO8601 to display them --- extra/webapps/mason/benchmarks/benchmarks.factor | 14 +++++++------- extra/webapps/mason/utils/utils.factor | 14 +++++++++----- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/extra/webapps/mason/benchmarks/benchmarks.factor b/extra/webapps/mason/benchmarks/benchmarks.factor index 67ed9b47b6..01b497b744 100644 --- a/extra/webapps/mason/benchmarks/benchmarks.factor +++ b/extra/webapps/mason/benchmarks/benchmarks.factor @@ -1,19 +1,19 @@ ! Copyright (C) 2024 nomennescio. ! See https://factorcode.org/license.txt for BSD license. -USING: accessors assocs combinators db.tuples formatting -furnace.actions html.forms http.server.responses io -io.streams.string kernel math.parser sequences -webapps.mason.backend webapps.mason.utils ; +USING: accessors assocs calendar calendar.format combinators +db.tuples formatting furnace.actions html.forms +http.server.responses io io.streams.string kernel math.parser +sequences webapps.mason.backend webapps.mason.utils ; IN: webapps.mason.benchmarks : benchmark-results ( -- response ) [ [ selected-benchmarks ] with-mason-db - "run,timestamp,host,os,cpu,git,name,duration (ns)" print + "run,timestamp (UTC),host,os,cpu,git,name,duration (ns)" print '[ [ run-id>> ] [ name>> ] [ duration>> ] tri - [ _ at { [ run-id>> ] [ timestamp>> ] [ host-name>> ] [ os>> ] [ cpu>> ] [ git-id>> ] } cleave ] 2dip - "%s,\"%s\",%s,%s,%s,%s,%s,%s\n" printf + [ _ at { [ run-id>> ] [ timestamp>> timestamp>iso8601Z ] [ host-name>> ] [ os>> ] [ cpu>> ] [ git-id>> ] } cleave ] 2dip + "%s,%s,%s,%s,%s,%s,%s,%s\n" printf ] each ] with-string-writer ; diff --git a/extra/webapps/mason/utils/utils.factor b/extra/webapps/mason/utils/utils.factor index dcff45cb91..5598a0ab9c 100644 --- a/extra/webapps/mason/utils/utils.factor +++ b/extra/webapps/mason/utils/utils.factor @@ -1,14 +1,18 @@ ! Copyright (C) 2010 Slava Pestov. ! See https://factorcode.org/license.txt for BSD license. -USING: accessors arrays assocs db.tuples furnace.actions -furnace.utilities html.forms kernel mason.config math.parser -namespaces sequences urls validators webapps.mason.backend +USING: accessors arrays assocs calendar calendar.format +db.tuples furnace.actions furnace.utilities html.forms +io.streams.string kernel mason.config math.parser namespaces +sequences urls validators webapps.mason.backend webapps.mason.version.data xml.syntax ; IN: webapps.mason.utils : link ( url label -- xml ) [XML ><-> XML] ; +: timestamp>iso8601Z ( timestamp -- string ) + [ >utc { YYYY MM DD "T" hhmm ss "Z" } formatted ] with-string-writer ; + : validate-os/cpu ( -- ) { { "os" [ v-one-line ] } @@ -22,14 +26,14 @@ IN: webapps.mason.utils { "cpu" [ [ v-one-line ] v-optional ] } { "git" [ [ v-one-line ] v-optional ] } { "run" [ [ v-one-line ] v-optional ] } - { "timestamp" [ [ v-one-line ] v-optional ] } + ! { "timestamp" [ [ v-one-line ] v-optional ] } ! parsing of ISO8601 is currently not supported { "name" [ [ v-one-line ] v-optional ] } } validate-params ; : selected-runs ( -- runs ) run new "run" value dec> >>run-id - "timestamp" value >>timestamp + ! "timestamp" value >>timestamp ! parsing of ISO8601 is currently not supported "host" value >>host-name "os" value >>os "cpu" value >>cpu -- 2.34.1