spider: threads on other desks, and fixed call sites

This commit is contained in:
Ted Blackman 2021-07-19 15:17:55 +03:00
parent ca01d6538a
commit cee258c9b6
14 changed files with 42 additions and 33 deletions

View File

@ -22,6 +22,7 @@
+* this .
do ~(. +> bowl)
def ~(. (default-agent this %|) bowl)
bec byk.bowl(r da+now.bowl)
::
++ on-init on-init:def
++ on-save !>(state)
@ -108,7 +109,7 @@
=/ new-tid=@ta
:((cury cat 3) dap.bowl '--' (scot %uv eny.bowl))
=/ args
[~ `new-tid %claz-prep-command !>([node-url command])]
[~ `new-tid bec %claz-prep-command !>([node-url command])]
:~ (watch-spider /prepare our.bowl /thread-result/[new-tid])
(poke-spider /prepare our.bowl %spider-start !>(args))
==

View File

@ -860,7 +860,8 @@
[%pass /wool %agent [our.hid %spider] %watch /thread-result/[tid]]
%- he-card
=/ =cage :: also sub
[%spider-start !>([~ `tid fil (dy-some src)])]
:: TODO: support threads on other desks
[%spider-start !>([~ `tid he-beak fil (dy-some src)])]
[%pass /wool %agent [our.hid %spider] %poke cage]
::
++ dy-make :: build step

View File

@ -49,6 +49,7 @@
+* this .
do ~(. +> bowl)
def ~(. (default-agent this %|) bowl)
bec byk.bowl(r da+now.bowl)
::
++ on-init on-init:def
++ on-save !>(state)
@ -137,9 +138,7 @@
^- (list card)
=/ tid=@ta
:((cury cat 3) dap.bowl '--' node-id '--' (scot %uv eny.bowl))
=/ args
:^ ~ `tid %eth-send-txs
!>([node step txs])
=/ args [~ `tid bec %eth-send-txs !>([node step txs]]
:~ (watch-spider /send/[tid] our.bowl /thread-result/[tid])
(poke-spider /send/[tid] our.bowl %spider-start !>(args))
==

View File

@ -64,6 +64,7 @@
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
bec byk.bowl(r da+now.bowl)
::
++ on-init
^- (quip card _this)
@ -462,8 +463,9 @@
(cat 3 'eth-watcher--' (scot %uv eny.bowl))
:_ dog(running `[now.bowl new-tid])
=/ args
:^ ~ `new-tid %eth-watcher
!>([~ `watchpup`[- number pending-logs blocks]:dog])
:* ~ `new-tid bec %eth-watcher
!>([~ `watchpup`[- number pending-logs blocks]:dog])
==
:~ (watch-spider path our.bowl /thread-result/[new-tid])
(poke-spider path our.bowl %spider-start !>(args))
==

View File

@ -62,6 +62,7 @@
+* this .
do ~(. +> bowl)
def ~(. (default-agent this %|) bowl)
bec byk.bowl(r da+now.bowl)
::
++ on-init
^- (quip card _this)
@ -296,7 +297,7 @@
::
%+ poke-spider /timestamps/[tid]
:- %spider-start
=- !>([~ `tid %eth-get-timestamps -])
=- !>([~ `tid bec %eth-get-timestamps -])
!> ^- [@t (list @ud)]
:- node-url
=- ~(tap in -)

View File

@ -56,7 +56,7 @@
==
::
+$ start-args
[parent=(unit tid) use=(unit tid) file=term =vase]
[parent=(unit tid) use=(unit tid) =beak file=term =vase]
--
::
:: Trie operations
@ -145,6 +145,7 @@
spider-core +>
sc ~(. spider-core bowl)
def ~(. (default-agent this %|) bowl)
bec byk.bowl(r da+now.bowl)
::
++ on-init
^- (quip card _this)
@ -271,7 +272,7 @@
::
~% %spider-helper ..get-yarn ~
|_ =bowl:gall
::
++ bec byk.bowl(r da+now.bowl)
++ bind-eyre
^- card
[%pass /bind %arvo %e %connect [~ /spider] %spider]
@ -302,15 +303,10 @@
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/json/[input-mark]
==
?> ?=(^ body.request.inbound-request)
=/ body=json
(need (de-json:html q.u.body.request.inbound-request))
=/ input=vase
(slop !>(~) (tube !>(body)))
=/ =start-args
[~ `tid thread input]
=^ cards state
(handle-start-thread start-args)
[cards state]
=/ body=json (need (de-json:html q.u.body.request.inbound-request))
=/ input=vase (slop !>(~) (tube !>(body)))
=/ =start-args [~ `tid bec thread input]
(handle-start-thread start-args)
::
++ on-poke-input
|= input
@ -345,7 +341,7 @@
::
++ handle-start-thread
~/ %handle-start-thread
|= [parent-tid=(unit tid) use=(unit tid) file=term =vase]
|= [parent-tid=(unit tid) use=(unit tid) =beak file=term =vase]
^- (quip card ^state)
=/ parent-yarn=yarn
?~ parent-tid
@ -366,11 +362,11 @@
==
=/ pax=path
~| no-file-for-thread+file
(need (get-fit:clay [our q.byk da+now]:bowl %ted file))
(need (get-fit:clay beak %ted file))
:_ state
:_ ~
:+ %pass /build/[new-tid]
[%arvo %c %warp our.bowl %base ~ %sing %a da+now.bowl pax]
[%arvo %c %warp p.beak q.beak ~ %sing %a r.beak pax]
::
++ handle-build
~/ %handle-build

View File

@ -1,4 +1,7 @@
:: Start a thread
:- %say
|= [* [name=term vase=$@(~ [vase ~])] ~]
[%spider-start ~ ~ name ?~(vase *^vase -.vase)]
|= $: [now=@da eny=@uvJ bec=beak]
[name=term vase=$@(~ [vase ~])]
~
==
[%spider-start ~ ~ bec name ?~(vase *^vase -.vase)]

View File

@ -81,7 +81,7 @@
=/ tid
%+ scot %ta
(cat 3 (cat 3 'strand_' i.threads) (scot %uv (sham i.threads eny.bowl)))
=/ poke-vase !>([`tid.bowl ~ i.threads *vase])
=/ poke-vase !>([`tid.bowl ~ byk.bowl i.threads *vase])
;< ~ bind:m (poke-our %spider %spider-start poke-vase)
loop(threads t.threads, tids (~(put by tids) i.threads tid))
::

View File

@ -704,16 +704,18 @@
::
++ start-thread
|= file=term
(start-thread-with-args file *vase)
=/ m (strand ,tid:spider)
;< =bowl:spider bind:m get-bowl
(start-thread-with-args byk.bowl file *vase)
::
++ start-thread-with-args
|= [file=term args=vase]
|= [=beak file=term args=vase]
=/ m (strand ,tid:spider)
^- form:m
;< =bowl:spider bind:m get-bowl
=/ tid
(scot %ta (cat 3 (cat 3 'strand_' file) (scot %uv (sham file eny.bowl))))
=/ poke-vase !>([`tid.bowl `tid file args])
=/ poke-vase !>([`tid.bowl `tid beak file args])
;< ~ bind:m (poke-our %spider %spider-start poke-vase)
;< ~ bind:m (sleep ~s0) :: wait for thread to start
(pure:m tid)

View File

@ -59,6 +59,7 @@
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
bec byk.bowl(r da+now.bowl)
++ on-init
^- (quip card _this)
:: delay through timer to make sure %spider has started
@ -252,7 +253,7 @@
?~ glob-details
[~ this]
=/ new-tid=@ta (cat 3 'glob--' (scot %uv (sham eny.bowl serve-path)))
=/ args [~ `new-tid %glob !>([~ hash.u.glob-details])]
=/ args [~ `new-tid bec %glob !>([~ hash.u.glob-details])]
=/ action=cage [%file-server-action !>([%unserve-dir serve-path])]
=/ spider-wire [(scot %uv hash.u.glob-details) serve-path]
=. globs.state

View File

@ -35,6 +35,7 @@
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
bec byk.bowl(r da+now.bowl)
desk q.byk.bowl
::
++ on-init
@ -225,7 +226,7 @@
[our.bowl %spider]
%poke
%spider-start
!>([~ `tid thread.observer (slop !>(~) q.cage.sign)])
!>([~ `tid bec thread.observer (slop !>(~) q.cage.sign)])
== ==
==
::

View File

@ -37,6 +37,7 @@
+* this .
do ~(. +> bowl)
def ~(. (default-agent this %|) bowl)
bec byk.bowl(r da+now.bowl)
::
++ on-init
^- (quip card _this)
@ -124,6 +125,7 @@
--
::
|_ =bowl:gall
++ bec byk.bowl(r da+now.bowl)
++ poke-spider
|= [=path =cage]
^- card
@ -150,7 +152,7 @@
^- (quip card _state)
=/ new-tid (new-tid eny.bowl)
=/ args
[~ `new-tid %eth-read-contract !>([url.state req])]
[~ `new-tid bec %eth-read-contract !>([url.state req])]
:_ state(running `new-tid)
:~ (watch-spider wire /thread-result/[new-tid])
(poke-spider wire %spider-start !>(args))

View File

@ -20,7 +20,7 @@
(pure:m !>(~))
;< ~ bind:m
%+ poke-our %spider
=- spider-start+!>([`tid.bowl ~ %graph-join -])
=- spider-start+!>([`tid.bowl ~ byk.bowl %graph-join -])
%+ slop !>(~)
!> ^- action:graph-view
[%join resource.invite ship.invite]

View File

@ -23,7 +23,7 @@
=* feed u.u.feed.config.metadatum.update
;< ~ bind:m
%+ poke-our %spider
=- spider-start+!>([`tid.bowl ~ %graph-join -])
=- spider-start+!>([`tid.bowl ~ byk.bowl %graph-join -])
%+ slop !>(~)
!> ^- action:graph-view
[%join resource.feed entity.resource.feed]