kiln: |pause and |resume an app

This commit is contained in:
Ted Blackman 2021-09-06 17:27:17 +03:00
parent 9c32c502d8
commit 248b968550
5 changed files with 146 additions and 52 deletions

View File

@ -2,8 +2,8 @@
/+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln /+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln
|% |%
+$ state +$ state
$~ [%17 *state:drum *state:helm *state:kiln] $~ [%18 *state:drum *state:helm *state:kiln]
$>(%17 any-state) $>(%18 any-state)
:: ::
+$ any-state +$ any-state
$% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)] $% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)]
@ -18,6 +18,7 @@
[%15 drum=state-2:drum helm=state:helm kiln=state-2:kiln] [%15 drum=state-2:drum helm=state:helm kiln=state-2:kiln]
[%16 drum=state-4:drum helm=state:helm kiln=state-3:kiln] [%16 drum=state-4:drum helm=state:helm kiln=state-3:kiln]
[%17 drum=state-4:drum helm=state:helm kiln=state-4:kiln] [%17 drum=state-4:drum helm=state:helm kiln=state-4:kiln]
[%18 drum=state-4:drum helm=state:helm kiln=state-5:kiln]
== ==
+$ any-state-tuple +$ any-state-tuple
$: drum=any-state:drum $: drum=any-state:drum

View File

@ -0,0 +1,5 @@
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[[=desk ~] ~]
==
[%kiln-pause desk]

View File

@ -0,0 +1,5 @@
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[[=desk ~] ~]
==
[%kiln-resume desk]

View File

@ -5,7 +5,8 @@
=, format =, format
=* dude dude:gall =* dude dude:gall
|% |%
+$ state state-4 +$ state state-5
+$ state-5 [%5 pith-5]
+$ state-4 [%4 pith-4] +$ state-4 [%4 pith-4]
+$ state-3 [%3 pith-3] +$ state-3 [%3 pith-3]
+$ state-2 [%2 pith-2] +$ state-2 [%2 pith-2]
@ -13,13 +14,14 @@
+$ state-0 [%0 pith-0] +$ state-0 [%0 pith-0]
+$ any-state +$ any-state
$~ *state $~ *state
$% state-4 $% state-5
state-4
state-3 state-3
state-2 state-2
state-1 state-1
state-0 state-0
== ==
+$ pith-4 :: +$ pith-5
$: rem=(map desk per-desk) :: $: rem=(map desk per-desk) ::
syn=(map kiln-sync let=@ud) :: syn=(map kiln-sync let=@ud) ::
ark=(map desk arak) :: ark=(map desk arak) ::
@ -33,6 +35,28 @@
:: request is made multiple times. :: request is made multiple times.
hxs=(map desk @ud) hxs=(map desk @ud)
== :: == ::
::
+$ pith-4 ::
$: rem=(map desk per-desk) ::
syn=(map kiln-sync let=@ud) ::
ark=(map desk arak-4) ::
commit-timer=[way=wire nex=@da tim=@dr mon=term] ::
:: map desk to the currently ongoing fuse request
:: and the latest version numbers for beaks to
fus=(map desk per-fuse)
:: used for fuses - every time we get a fuse we
:: bump this. used when calculating hashes to
:: ensure they're unique even when the same
:: request is made multiple times.
hxs=(map desk @ud)
== ::
+$ arak-4
$: =ship
=desk
=aeon
next=(list rung)
=rein
==
+$ pith-3 :: +$ pith-3 ::
$: rem=(map desk per-desk) :: $: rem=(map desk per-desk) ::
syn=(map kiln-sync let=@ud) :: syn=(map kiln-sync let=@ud) ::
@ -51,7 +75,7 @@
$: =ship $: =ship
=desk =desk
=aeon =aeon
next=(list [=aeon =weft]) next=(list rung)
rein=rein-3 rein=rein-3
== ==
+$ rein-3 +$ rein-3
@ -217,17 +241,20 @@
fus.old fus.old
hxs.old hxs.old
== ==
=? old ?=(%3 -.old)
:* %4
rem.old
syn.old
ark=(~(run by ark.old) |=(a=arak-3 a(rein [liv=& rein.a])))
commit-timer.old
fus.old
hxs.old
==
:: ::
?> ?=(%4 -.old) =? old ?=(%3 -.old)
:- %4
+.old(ark (~(run by ark.old) |=(a=arak-3 a(rein [liv=& rein.a]))))
::
=? old ?=(%4 -.old)
:- %5
=- +.old(ark -)
%- ~(run by ark.old)
|= a=arak-4
^- arak
[[paused=| ship desk aeon] next rein]:a
::
?> ?=(%5 -.old)
=. +<+.$.abet old =. +<+.$.abet old
=< abet =< abet
?~ old-ota ?~ old-ota
@ -279,7 +306,7 @@
~_ leaf/"kiln: {<lac>} not installed" ~_ leaf/"kiln: {<lac>} not installed"
vats(loc lac, rak (~(got by ark) lac)) vats(loc lac, rak (~(got by ark) lac))
:: ::
++ here "{<loc>} from {<[ship desk]:rak>}" ++ here "{<loc>} from {<[ship desk]:rail.rak>}"
++ make-wire |=(step=@tas /kiln/vats/[loc]/[step]) ++ make-wire |=(step=@tas /kiln/vats/[loc]/[step])
++ from-wire ++ from-wire
|= =wire |= =wire
@ -299,17 +326,21 @@
++ pyre |=(=tang [%pass /kiln/vats %pyre tang]) ++ pyre |=(=tang [%pass /kiln/vats %pyre tang])
++ find (warp %find [%sing %y ud+1 /]) ++ find (warp %find [%sing %y ud+1 /])
++ sync-da (warp %sync [%sing %w da+now /]) ++ sync-da (warp %sync [%sing %w da+now /])
++ sync-ud (warp %sync [%sing %w ud+aeon.rak /]) ++ sync-ud (warp %sync [%sing %w ud+aeon.rail.rak /])
++ download (warp %download [%sing %v ud+aeon.rak /]) ++ download (warp %download [%sing %v ud+aeon.rail.rak /])
++ warp |=([s=term r=rave] (clay-card s %warp ship.rak desk.rak `r)) ++ warp
|= [s=term r=rave]
(clay-card s %warp ship.rail.rak desk.rail.rak `r)
++ merge-main ++ merge-main
=/ germ (get-germ loc) =/ germ (get-germ loc)
=/ =aeon (dec aeon.rak) =/ =aeon (dec aeon.rail.rak)
(clay-card %merge-main [%merg loc ship.rak desk.rak ud+aeon germ]) %+ clay-card %merge-main
[%merg loc ship.rail.rak desk.rail.rak ud+aeon germ]
++ merge-kids ++ merge-kids
=/ germ (get-germ %kids) =/ germ (get-germ %kids)
=/ =aeon (dec aeon.rak) =/ =aeon (dec aeon.rail.rak)
(clay-card %merge-kids [%merg %kids ship.rak desk.rak ud+aeon germ]) %+ clay-card %merge-kids
[%merg %kids ship.rail.rak desk.rail.rak ud+aeon germ]
++ clay-card ++ clay-card
|= [step=@tas =task:clay] |= [step=@tas =task:clay]
^- card:agent:gall ^- card:agent:gall
@ -361,7 +392,7 @@
vats vats
=? kiln ?=(^ got) (uninstall lac) =? kiln ?=(^ got) (uninstall lac)
=: loc lac =: loc lac
rak [her rem *aeon next=~ *rein] rak [[paused=| her rem *aeon] next=~ *rein]
== ==
~> %slog.0^leaf/"kiln: beginning install into {here}" ~> %slog.0^leaf/"kiln: beginning install into {here}"
(emit find:pass) (emit find:pass)
@ -372,7 +403,32 @@
~> %slog.0^leaf/"kiln: resetting tracking for {here}" ~> %slog.0^leaf/"kiln: resetting tracking for {here}"
=. vats (emit (diff:give %reset loc rak)) =. vats (emit (diff:give %reset loc rak))
=. ark (~(del by ark) loc) =. ark (~(del by ark) loc)
(install loc [ship desk]:rak) (install loc [ship desk]:rail.rak)
:: +pause: stop syncing from upstream
::
++ pause
|= lac=desk
^+ vats
=. vats (abed lac)
~> %slog. :+ %0 %leaf
?: paused.rail.rak
"kiln: {<lac>} already paused, ignoring"
"kiln: {<lac>} pausing updates"
=: paused.rail.rak &
aeon.rail.rak 0
==
vats
:: +resume: restart tracking from upstream
::
++ resume
|= lac=desk
^+ vats
=. vats (abed lac)
~> %slog. :+ %0 %leaf
?. paused.rail.rak
"kiln: {<lac>} already tracking, ignoring"
"kiln: {<lac>} resuming updates"
reset
:: +suspend: shut down all agents, keep syncing :: +suspend: shut down all agents, keep syncing
:: ::
++ suspend ++ suspend
@ -498,6 +554,8 @@
|= syn=sign-arvo |= syn=sign-arvo
^+ vats ^+ vats
?> ?=(%writ +<.syn) ?> ?=(%writ +<.syn)
?: paused.rail.rak
vats
?~ p.syn ?~ p.syn
~> %slog.0^leaf/"kiln: cancelled (1) install into {here}, aborting" ~> %slog.0^leaf/"kiln: cancelled (1) install into {here}, aborting"
vats(ark (~(del by ark) loc)) vats(ark (~(del by ark) loc))
@ -508,24 +566,28 @@
|= syn=sign-arvo |= syn=sign-arvo
^+ vats ^+ vats
?> ?=(%writ +<.syn) ?> ?=(%writ +<.syn)
?: paused.rail.rak
vats
?~ p.syn ?~ p.syn
~> %slog.0^leaf/"kiln: cancelled (1) install into {here}, retrying" ~> %slog.0^leaf/"kiln: cancelled (1) install into {here}, retrying"
reset reset
~> %slog.0^leaf/"kiln: downloading update for {here}" ~> %slog.0^leaf/"kiln: downloading update for {here}"
=? aeon.rak ?=(%w p.p.u.p.syn) ud:;;(cass:clay q.q.r.u.p.syn) =? aeon.rail.rak ?=(%w p.p.u.p.syn) ud:;;(cass:clay q.q.r.u.p.syn)
(emit download:pass) (emit download:pass)
:: ::
++ take-download ++ take-download
|= syn=sign-arvo |= syn=sign-arvo
^+ vats ^+ vats
?> ?=(%writ +<.syn) ?> ?=(%writ +<.syn)
?: paused.rail.rak
vats
?~ p.syn ?~ p.syn
~> %slog.0^leaf/"kiln: cancelled (2) install into {here}, retrying" ~> %slog.0^leaf/"kiln: cancelled (2) install into {here}, retrying"
reset reset
~> %slog.0^leaf/"kiln: finished downloading update for {here}" ~> %slog.0^leaf/"kiln: finished downloading update for {here}"
=/ old-weft `weft`[%zuse zuse] =/ old-weft `weft`[%zuse zuse]
=/ new-weft (read-kelvin-foreign [ship desk aeon]:rak) =/ new-weft (read-kelvin-foreign [ship desk aeon]:rail.rak)
=. aeon.rak +(aeon.rak) =. aeon.rail.rak +(aeon.rail.rak)
:: ::
?. =(%base loc) ?. =(%base loc)
:: TODO: ?> =(%zuse lal.new-weft) but more flexible for future renames :: TODO: ?> =(%zuse lal.new-weft) but more flexible for future renames
@ -536,11 +598,11 @@
(emil sync-ud:pass (diff:give diff) ~) (emil sync-ud:pass (diff:give diff) ~)
?: (lth num.new-weft num.old-weft) ?: (lth num.new-weft num.old-weft)
~> %slog.0^leaf/"kiln: future version {<new-weft>}, enqueueing" ~> %slog.0^leaf/"kiln: future version {<new-weft>}, enqueueing"
=. next.rak (snoc next.rak [(dec aeon.rak) new-weft]) =. next.rak (snoc next.rak [(dec aeon.rail.rak) new-weft])
=/ =diff [%block loc rak new-weft blockers=(sy %base ~)] =/ =diff [%block loc rak new-weft blockers=(sy %base ~)]
(emil sync-ud:pass (diff:give diff) ~) (emil sync-ud:pass (diff:give diff) ~)
~> %slog.0^leaf/"kiln: merging into {here}" ~> %slog.0^leaf/"kiln: merging into {here}"
=. next.rak +:(crank-next %& (dec aeon.rak)) =. next.rak +:(crank-next %& (dec aeon.rail.rak))
(emil ~[merge-main sync-ud]:pass) (emil ~[merge-main sync-ud]:pass)
:: ::
=/ blockers =/ blockers
@ -550,11 +612,11 @@
:: ::
?. =(~ blockers) ?. =(~ blockers)
~> %slog.0^leaf/"kiln: OTA blocked on {<blockers>}" ~> %slog.0^leaf/"kiln: OTA blocked on {<blockers>}"
=. next.rak (snoc next.rak [(dec aeon.rak) new-weft]) =. next.rak (snoc next.rak [(dec aeon.rail.rak) new-weft])
=/ =diff [%block loc rak new-weft blockers] =/ =diff [%block loc rak new-weft blockers]
(emil sync-ud:pass (diff:give diff) ~) (emil sync-ud:pass (diff:give diff) ~)
~> %slog.0^leaf/"kiln: applying OTA to {here}, kelvin: {<new-weft>}" ~> %slog.0^leaf/"kiln: applying OTA to {here}, kelvin: {<new-weft>}"
=. next.rak +:(crank-next %& (dec aeon.rak)) =. next.rak +:(crank-next %& (dec aeon.rail.rak))
(emil ~[merge-main sync-ud]:pass) (emil ~[merge-main sync-ud]:pass)
:: ::
++ take-merge-main ++ take-merge-main
@ -624,9 +686,9 @@
:: ::
++ crank-next ++ crank-next
|= new=(each aeon weft) |= new=(each aeon weft)
^+ [match=*(unit [=aeon =weft]) next.rak] ^+ [match=*(unit rung) next.rak]
=/ rog next.rak =/ rog next.rak
|- ^+ [match=*(unit [=aeon =weft]) next.rak] |- ^+ [match=*(unit rung) next.rak]
?~ rog [~ next.rak] ?~ rog [~ next.rak]
?: ?- -.new ?: ?- -.new
%& =(p.new aeon.i.rog) %& =(p.new aeon.i.rog)
@ -683,12 +745,14 @@
%kiln-merge =;(f (f !<(_+<.f vase)) poke-merge) %kiln-merge =;(f (f !<(_+<.f vase)) poke-merge)
%kiln-mount =;(f (f !<(_+<.f vase)) poke-mount) %kiln-mount =;(f (f !<(_+<.f vase)) poke-mount)
%kiln-nuke =;(f (f !<(_+<.f vase)) poke-nuke) %kiln-nuke =;(f (f !<(_+<.f vase)) poke-nuke)
%kiln-suspend =;(f (f !<(_+<.f vase)) poke-suspend) %kiln-pause =;(f (f !<(_+<.f vase)) poke-pause)
%kiln-permission =;(f (f !<(_+<.f vase)) poke-permission) %kiln-permission =;(f (f !<(_+<.f vase)) poke-permission)
%kiln-resume =;(f (f !<(_+<.f vase)) poke-resume)
%kiln-revive =;(f (f !<(_+<.f vase)) poke-revive) %kiln-revive =;(f (f !<(_+<.f vase)) poke-revive)
%kiln-rein =;(f (f !<(_+<.f vase)) poke-rein) %kiln-rein =;(f (f !<(_+<.f vase)) poke-rein)
%kiln-rm =;(f (f !<(_+<.f vase)) poke-rm) %kiln-rm =;(f (f !<(_+<.f vase)) poke-rm)
%kiln-schedule =;(f (f !<(_+<.f vase)) poke-schedule) %kiln-schedule =;(f (f !<(_+<.f vase)) poke-schedule)
%kiln-suspend =;(f (f !<(_+<.f vase)) poke-suspend)
%kiln-sync =;(f (f !<(_+<.f vase)) poke-sync) %kiln-sync =;(f (f !<(_+<.f vase)) poke-sync)
%kiln-syncs =;(f (f !<(_+<.f vase)) poke-syncs) %kiln-syncs =;(f (f !<(_+<.f vase)) poke-syncs)
%kiln-track =;(f (f !<(_+<.f vase)) poke-track) %kiln-track =;(f (f !<(_+<.f vase)) poke-track)
@ -837,6 +901,10 @@
%+ turn (get-apps-have our term now) %+ turn (get-apps-have our term now)
|=([=dude ?] [%pass /nuke %arvo %g [%nuke dude]]) |=([=dude ?] [%pass /nuke %arvo %g [%nuke dude]])
:: ::
++ poke-pause
|= =desk
abet:abet:(pause:vats desk)
::
++ poke-permission ++ poke-permission
|= [syd=desk pax=path pub=?] |= [syd=desk pax=path pub=?]
=< abet =< abet
@ -848,6 +916,10 @@
|= [=desk =rein] |= [=desk =rein]
abet:abet:(set-rein:vats +<) abet:abet:(set-rein:vats +<)
:: ::
++ poke-resume
|= =desk
abet:abet:(resume:vats desk)
::
++ poke-revive ++ poke-revive
|= =desk |= =desk
abet:abet:(revive:vats desk) abet:abet:(revive:vats desk)

View File

@ -15,15 +15,26 @@
== ==
:: $arak: foreign vat tracker :: $arak: foreign vat tracker
:: ::
:: .next is a list of pending commits with future kelvins :: .rail: upstream tracking state, if any
:: .next: list of pending commits with future kelvins
:: .rein: configuration for agents
:: ::
+$ arak +$ arak
$: =ship $: =rail
=desk next=(list rung)
=aeon
next=(list [=aeon =weft])
=rein =rein
== ==
:: $rail: upstream tracking state
::
+$ rail
$: paused=?
=ship
=desk
=aeon
==
:: $rung: reference to upstream commit
::
+$ rung [=aeon =weft]
:: $rein: diff from desk manifest :: $rein: diff from desk manifest
:: ::
:: .liv: suspended? :: .liv: suspended?
@ -63,9 +74,9 @@
:~ leaf/"/sys/kelvin: {<[lal num]:weft>}" :~ leaf/"/sys/kelvin: {<[lal num]:weft>}"
leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}" leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}"
leaf/"%cz hash: {<hash>}" leaf/"%cz hash: {<hash>}"
leaf/"source ship: {<ship.arak>}" leaf/"source ship: {<ship.rail.arak>}"
leaf/"source desk: {<desk.arak>}" leaf/"source desk: {<desk.rail.arak>}"
leaf/"source aeon: {<aeon.arak>}" leaf/"source aeon: {<aeon.rail.arak>}"
leaf/"status: {sat}" leaf/"status: {sat}"
leaf/"force on: {?:(=(~ add.rein.arak) "~" <add.rein.arak>)}" leaf/"force on: {?:(=(~ add.rein.arak) "~" <add.rein.arak>)}"
leaf/"force off: {?:(=(~ sub.rein.arak) "~" <sub.rein.arak>)}" leaf/"force off: {?:(=(~ sub.rein.arak) "~" <sub.rein.arak>)}"
@ -146,10 +157,10 @@
:: ::
++ mergebase-hashes ++ mergebase-hashes
|= [our=@p =desk now=@da =arak] |= [our=@p =desk now=@da =arak]
=/ her (scot %p ship.arak) =/ her (scot %p ship.rail.arak)
=/ ego (scot %p our) =/ ego (scot %p our)
=/ wen (scot %da now) =/ wen (scot %da now)
%+ turn .^((list tako) %cs ~[ego desk wen %base her desk.arak]) %+ turn .^((list tako) %cs ~[ego desk wen %base her desk.rail.arak])
|=(=tako .^(@uv %cs ~[ego desk wen %hash (scot %uv tako)])) |=(=tako .^(@uv %cs ~[ego desk wen %hash (scot %uv tako)]))
:: ::
++ enjs ++ enjs
@ -192,10 +203,10 @@
== ==
:: ::
++ woof ++ woof
|= w=[=aeon =^weft] |= =rung
%- pairs %- pairs
:~ aeon+(numb aeon.w) :~ aeon+(numb aeon.rung)
weft+(weft weft.w) weft+(weft weft.rung)
== ==
:: ::
++ rein ++ rein
@ -208,9 +219,9 @@
++ arak ++ arak
|= a=^arak |= a=^arak
%- pairs %- pairs
:~ ship+s+(scot %p ship.a) :~ ship+s+(scot %p ship.rail.a)
desk+s+desk.a desk+s+desk.rail.a
aeon+(numb aeon.a) aeon+(numb aeon.rail.a)
next+a+(turn next.a woof) next+a+(turn next.a woof)
rein+(rein rein.a) rein+(rein rein.a)
== ==