[wip] rename the experiment to task_runner_streams

This commit is contained in:
Michael Bradley, Jr 2021-12-02 16:51:29 -06:00
parent 8ea2a9429a
commit c01986c7a5
No known key found for this signature in database
GPG Key ID: D0307DBCF21A9A58
3 changed files with 16 additions and 16 deletions

View File

@ -175,9 +175,9 @@ jobs:
run: |
make test
- name: Build and run localstore experiment
- name: Build and run task_runner_streams experiment
if: matrix.target.os != 'windows'
shell: bash
working-directory: nim-dagger
run: |
./env.sh nimble localstore
./env.sh nimble task_runner_streams

View File

@ -39,7 +39,7 @@ task testAll, "Build & run Waku v1 tests":
import os
task localstore, "Build localstore experiment":
task task_runner_streams, "Build task_runner_streams experiment":
const
build_opts =
when defined(danger) or defined(release):
@ -58,7 +58,7 @@ task localstore, "Build localstore experiment":
common_opts =
" --define:ssl" &
" --out:build/localstore" &
" --out:build/task_runner_streams" &
" --threads:on" &
" --tlsEmulation:off"
@ -86,8 +86,8 @@ task localstore, "Build localstore experiment":
(when host != "": " --define:host=" & host else: "") &
(when maxRequestBodySize != "": " --define:maxRequestBodySize=" & maxRequestBodySize else: "") &
(when port != "": " --define:port=" & port else: "") &
" experiments/localstore.nim",
"build/localstore"
" experiments/task_runner_streams.nim",
"build/task_runner_streams"
]
for command in commands:

View File

@ -4,20 +4,20 @@ import pkg/[chronicles, stew/byteutils, task_runner]
import pkg/[chronos/apps/http/httpcommon, chronos/apps/http/httpserver]
logScope:
topics = "localstore"
topics = "experiment"
type LocalstoreArg = ref object of ContextArg
type ExperimentArg = ref object of ContextArg
const
experiment = "experiment"
host {.strdefine.} = "127.0.0.1"
localstore = "localstore"
maxRequestBodySize {.intdefine.} = 10 * 1_048_576
port {.strdefine.} = "30080"
proc localstoreContext(arg: ContextArg) {.async, gcsafe, nimcall,
proc experimentContext(arg: ContextArg) {.async, gcsafe, nimcall,
raises: [Defect].} =
let contextArg = cast[LocalstoreArg](arg)
let contextArg = cast[ExperimentArg](arg)
discard
proc readFromStreamWriteToFile(rfd: int, destPath: string)
@ -56,7 +56,7 @@ proc main() {.async.} =
createDir(destDir)
var
localstoreArg = LocalstoreArg()
experimentArg = ExperimentArg()
runner = TaskRunner.new
runnerPtr {.threadvar.}: pointer
@ -88,7 +88,7 @@ proc main() {.async.} =
else:
(0, true)
asyncSpawn readFromStreamWriteToFile(runner, localstore, rfd.int, destPath)
asyncSpawn readFromStreamWriteToFile(runner, experiment, rfd.int, destPath)
await request.getBodyReader.tryGet.readMessage(pred)
await writer.closeWait
discard request.respond(Http200)
@ -108,11 +108,11 @@ proc main() {.async.} =
setControlCHook(stop)
runner.createWorker(pool, localstore, localstoreContext, localstoreArg, 8)
runner.workers[localstore].worker.awaitTasks = false
runner.createWorker(pool, experiment, experimentContext, experimentArg, 8)
runner.workers[experiment].worker.awaitTasks = false
await runner.start
server.start
asyncSpawn runner.scheduleStop(10.seconds)
# asyncSpawn runner.scheduleStop(10.seconds)
while runner.running.load: poll()