Behn pass errors to client vanes (#1135)

* [%wake (unit tang)] in Behn and Zuse; no other vanes compile

* ames compiles

* clay compiles

* eyre compiles

* jael compiles

* Aqua send %crud on behn error
This commit is contained in:
Ted Blackman 2019-04-09 20:15:37 -07:00 committed by GitHub
parent da126f6ea6
commit 20a0a50570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 90 additions and 38 deletions

View File

@ -58,12 +58,12 @@
:: Received timer wake :: Received timer wake
:: ::
++ wake ++ wake
|= [way=wire ~] |= [way=wire error=(unit tang)]
^- (quip move _this) ^- (quip move _this)
=. this apex =< abet =. this apex =< abet
?> ?=([@ *] way) ?> ?=([@ *] way)
=/ who (,@p (slav %p i.way)) =/ who (,@p (slav %p i.way))
abet-pe:(take-wake:(pe who) t.way ~) abet-pe:(take-wake:(pe who) t.way error)
:: ::
++ pe ++ pe
|= who=ship |= who=ship
@ -114,12 +114,18 @@
..abet-pe ..abet-pe
:: ::
++ take-wake ++ take-wake
|= [way=wire ~] |= [way=wire error=(unit tang)]
~? debug=| [who=who %aqua-behn-wake now] ~? debug=| [who=who %aqua-behn-wake now error=error]
=. next-timer ~ =. next-timer ~
=. this =. this
%- emit-aqua-events %- emit-aqua-events
[%event who [//behn/0v1n.2m9vh %wake ~]]~ :_ ~
^- aqua-event
:+ %event who
:- //behn/0v1n.2m9vh
?~ error
[%wake ~]
[%crud %fail u.error]
..abet-pe ..abet-pe
-- --
-- --

View File

@ -1374,6 +1374,12 @@
~/ %knap ~/ %knap
|= [tea=wire hen=duct sih=sign:able] |= [tea=wire hen=duct sih=sign:able]
^- [(list move) _+>] ^- [(list move) _+>]
:: if we got an error from behn, report it to %dill; TODO handle errors
::
?: ?=([%wake ^] +.sih)
=/ =flog:dill [%crud %wake u.error.sih]
[[hen %slip %d %flog flog]~ +>.$]
::
?- +<.sih ?- +<.sih
%crud [[[hen [%slip %d %flog +.sih]] ~] +>] %crud [[[hen [%slip %d %flog +.sih]] ~] +>]
:: ::
@ -1421,6 +1427,8 @@
^- [p=(list boon) q=fort] ^- [p=(list boon) q=fort]
?- +<.sih ?- +<.sih
:: ::
:: only handles the non-error %wake case; error case above
::
%wake %wake
(~(wake am [our now fox ski]) hen) (~(wake am [our now fox ski]) hen)
:: ::

View File

@ -28,12 +28,25 @@
:: +born: urbit restarted; refresh :next-wake and store wakeup timer duct :: +born: urbit restarted; refresh :next-wake and store wakeup timer duct
:: ::
++ born set-unix-wake(next-wake.state ~, unix-duct.state duct) ++ born set-unix-wake(next-wake.state ~, unix-duct.state duct)
:: +crud: error report; hand off to %dill to be printed :: +crud: handle failure of previous arvo event
:: ::
++ crud ++ crud
|= [p=@tas q=tang] |= [tag=@tas error=tang]
^+ [moves state] ^+ [moves state]
[[duct %slip %d %flog %crud p q]~ state] :: behn must get activated before other vanes in a %wake
::
:: TODO: uncomment this case after switching %crud tags
::
:: We don't know how to handle other errors, so relay them to %dill
:: to be printed and don't treat them as timer failures.
::
:: ?. =(%wake tag)
:: ~& %behn-crud-not-first-activation^tag
:: [[duct %slip %d %flog %crud tag error]~ state]
::
?: =(~ timers.state) ~| %behn-crud-no-timer^tag^error !!
::
(wake `error)
:: +rest: cancel the timer at :date, then adjust unix wakeup :: +rest: cancel the timer at :date, then adjust unix wakeup
:: +wait: set a new timer at :date, then adjust unix wakeup :: +wait: set a new timer at :date, then adjust unix wakeup
:: ::
@ -45,9 +58,15 @@
:: +wake: unix says wake up; process the elapsed timer and set :next-wake :: +wake: unix says wake up; process the elapsed timer and set :next-wake
:: ::
++ wake ++ wake
|= error=(unit tang)
^+ [moves state] ^+ [moves state]
:: ::
?~ timers.state ~|(%behn-wake-no-timer !!) ?~ timers.state ~| %behn-wake-no-timer^error !!
:: if we errored, pop the timer and notify the client vane of the error
::
?^ error
=< set-unix-wake
(emit-vane-wake(timers.state t.timers.state) duct.i.timers.state error)
:: if unix woke us too early, retry by resetting the unix wakeup timer :: if unix woke us too early, retry by resetting the unix wakeup timer
:: ::
?: (gth date.i.timers.state now) ?: (gth date.i.timers.state now)
@ -56,7 +75,7 @@
:: pop first timer, tell vane it has elapsed, and adjust next unix wakeup :: pop first timer, tell vane it has elapsed, and adjust next unix wakeup
:: ::
=< set-unix-wake =< set-unix-wake
(emit-vane-wake(timers.state t.timers.state) duct.i.timers.state) (emit-vane-wake(timers.state t.timers.state) duct.i.timers.state ~)
:: +wegh: produce memory usage report for |mass :: +wegh: produce memory usage report for |mass
:: ::
++ wegh ++ wegh
@ -74,7 +93,9 @@
++ event-core . ++ event-core .
:: +emit-vane-wake: produce a move to wake a vane; assumes no prior moves :: +emit-vane-wake: produce a move to wake a vane; assumes no prior moves
:: ::
++ emit-vane-wake |=(=^duct event-core(moves [duct %give %wake ~]~)) ++ emit-vane-wake
|= [=^duct error=(unit tang)]
event-core(moves [duct %give %wake error]~)
:: +emit-doze: set new unix wakeup timer in state and emit move to unix :: +emit-doze: set new unix wakeup timer in state and emit move to unix
:: ::
:: We prepend the unix %doze event so that it is handled first. Arvo must :: We prepend the unix %doze event so that it is handled first. Arvo must
@ -186,11 +207,11 @@
=^ moves state =^ moves state
?- -.task ?- -.task
%born born:event-core %born born:event-core
%crud (crud:event-core [p q]:task) %crud (crud:event-core [tag tang]:task)
%rest (rest:event-core date=p.task) %rest (rest:event-core date=p.task)
%vega vega:event-core %vega vega:event-core
%wait (wait:event-core date=p.task) %wait (wait:event-core date=p.task)
%wake wake:event-core %wake (wake:event-core error=~)
%wegh wegh:event-core %wegh wegh:event-core
== ==
[moves behn-gate] [moves behn-gate]

View File

@ -368,7 +368,7 @@
$% [%made date=@da result=made-result:ford] :: $% [%made date=@da result=made-result:ford] ::
== == :: == == ::
$: $b :: $: $b ::
$% {$wake ~} :: timer activate $% {$wake error=(unit tang)} :: timer activate
== == :: == == ::
$: @tas :: by any $: @tas :: by any
$% {$crud p/@tas q/(list tank)} :: $% {$crud p/@tas q/(list tank)} ::
@ -4242,6 +4242,11 @@
:: ::
$note [[hen %give +.q.hin]~ ..^$] $note [[hen %give +.q.hin]~ ..^$]
$wake $wake
:: TODO: handle behn errors
::
?^ error.q.hin
[[hen %slip %d %flog %crud %wake u.error.q.hin]~ ..^$]
::
?: ?=([%tyme ~] tea) ?: ?=([%tyme ~] tea)
~& %out-of-tyme ~& %out-of-tyme
`..^$ `..^$

View File

@ -42,7 +42,7 @@
$% {$woot p/ship q/coop} :: acknowledgment $% {$woot p/ship q/coop} :: acknowledgment
== == :: == == ::
$: $b :: by %behn $: $b :: by %behn
$% {$wake ~} :: timer activate $% {$wake error=(unit tang)} :: timer activate
== == :: == == ::
$: $g :: by %gall $: $g :: by %gall
$% {$unto p/cuft:gall} :: within agent $% {$unto p/cuft:gall} :: within agent
@ -1028,6 +1028,11 @@
== ==
:: ::
$wake $wake
:: TODO: handle behn errors
::
?^ error.sih
+>.$(mow [[hen %slip %d %flog %crud %wake u.error.sih] mow])
::
?> ?=({?($of $ow) @ ~} tee) ?> ?=({?($of $ow) @ ~} tee)
?: ?=($ow -.tee) ?: ?=($ow -.tee)
abut:(ire-ix p.tee) abut:(ire-ix p.tee)

View File

@ -982,6 +982,12 @@
?. ?=([%init ~] wir) ?. ?=([%init ~] wir)
abet:~(wake et hen our now urb.lex sub.lex etn.lex sap.lex) abet:~(wake et hen our now urb.lex sub.lex etn.lex sap.lex)
abet:(~(init et hen our now [urb sub etn sap]:lex) our (sein our)) abet:(~(init et hen our now [urb sub etn sap]:lex) our (sein our))
::
[%b %wake ^]
:: TODO: handle behn error
::
~& %jael-wake-bad^u.error.hin
+>.$
:: ::
[%j %vent *] [%j %vent *]
%+ cute hen =< abet %+ cute hen =< abet

View File

@ -226,7 +226,7 @@
== :: == ::
++ sign :: in result _<- ++ sign :: in result _<-
$% $: $b :: to %behn $% $: $b :: to %behn
$% {$wake ~} :: timer activate $% {$wake error=(unit tang)} :: timer activate
== == :: == == ::
$: %j :: from %jael $: %j :: from %jael
$% [%pubs public:able:jael] :: public keys $% [%pubs public:able:jael] :: public keys
@ -424,23 +424,23 @@
++ able ^? ++ able ^?
|% |%
++ note :: out request $-> ++ note :: out request $->
$% $: $d :: to %dill $% $: %d :: to %dill
$% {$flog p/flog:dill} :: $% [$flog =flog:dill]
== == == :: == == ==
++ gift :: out result <-$ ++ gift :: out result <-$
$% {$doze p/(unit @da)} :: next alarm $% [%doze p=(unit @da)] :: next alarm
{$mass p/mass} :: memory usage [%mass p=mass] :: memory usage
{$wake ~} :: wakeup [%wake error=(unit tang)] :: wakeup or failed
== :: ==
++ task :: in request ->$ ++ task :: in request ->$
$% {$born ~} :: new unix process $% [%born ~] :: new unix process
{$crud p/@tas q/(list tank)} :: error with trace [%crud tag=@tas =tang] :: error with trace
{$rest p/@da} :: cancel alarm [%rest p=@da] :: cancel alarm
{$vega ~} :: report upgrade [%vega ~] :: report upgrade
{$wait p/@da} :: set alarm [%wait p=@da] :: set alarm
{$wake ~} :: timer activate [%wake ~] :: timer activate
{$wegh ~} :: report memory [%wegh ~] :: report memory
== :: ==
-- ::able -- ::able
-- ::behn -- ::behn
:: :::: :: ::::
@ -1849,7 +1849,7 @@
+$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)] +$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)]
:: ::
++ sign :: in result $<- ++ sign :: in result $<-
$% {$b $wake ~} :: wakeup $% {$b $wake error=(unit tang)} :: wakeup
[%e %sigh p=cage] :: marked http response [%e %sigh p=cage] :: marked http response
[%j %vent p=vent-result] :: ethereum changes [%j %vent p=vent-result] :: ethereum changes
[%a %woot p=ship q=coop] :: message result [%a %woot p=ship q=coop] :: message result
@ -7099,16 +7099,17 @@
++ unix-task :: input from unix ++ unix-task :: input from unix
$% {$belt p/belt:dill} :: dill: keyboard $% {$belt p/belt:dill} :: dill: keyboard
{$blew p/blew:dill} :: dill: configure {$blew p/blew:dill} :: dill: configure
{$boat ~} :: clay: reboot {$boat ~} :: clay: reboot
{$born ~} :: eyre: new process {$born ~} :: eyre: new process
{$hail ~} :: dill: refresh [%crud tag=@tas =tang] :: any vane: error report
{$hail ~} :: dill: refresh
{$hear p/lane:ames q/@} :: ames: input packet {$hear p/lane:ames q/@} :: ames: input packet
{$hook ~} :: dill: hangup {$hook ~} :: dill: hangup
{$into p/desk q/? r/mode:clay} :: clay: external edit {$into p/desk q/? r/mode:clay} :: clay: external edit
{$they p/@ud q/httr:eyre} :: eyre: in response {$they p/@ud q/httr:eyre} :: eyre: in response
{$this p/? q/clip:eyre r/httq:eyre} :: eyre: in request {$this p/? q/clip:eyre r/httq:eyre} :: eyre: in request
{$thud ~} :: eyre: in cancel {$thud ~} :: eyre: in cancel
{$wake ~} :: behn: wakeup {$wake ~} :: behn: wakeup
== ==
:: :: :: ::
:::: ++azimuth :: (2az) azimuth :::: ++azimuth :: (2az) azimuth