diff --git a/.log b/.log new file mode 100644 index 00000000..fe91fb44 Binary files /dev/null and b/.log differ diff --git a/di/async/test.csv b/di/async/test.csv deleted file mode 100644 index 27a4c5bb..00000000 --- a/di/async/test.csv +++ /dev/null @@ -1,27 +0,0 @@ -action,ms,bytes,lang,code,repeat,minver,comment -before,0,0,q,async:use`di.async,1,1,load module into session - -comment,,,,,,,Testing async.deferred -run,0,0,q,.test.bdefres1:async.deferred[h;({x+1};1)],1,,testing async.deferred call that should execute on both servers -true,0,0,q,.test.bdefres1~((1b;1b);(2;2)),1,,successful async.deferred call with expected result -run,0,0,q,.test.bdefres2:async.deferred[h;({x+`a};1)],1,,testing async.deferred call that should fail -true,0,0,q,not any .test.bdefres2[0;],1,,async.deferred call failed on both servers with expected result -run,0,0,q,.test.bdefres3:async.deferred[h;(`f;1)],1,,testing async.deferred call that should fail on one server -true,0,0,q,10b ~ .test.bdefres3[0;],1,,async.deferred call failed on one server with expected result -run,0,0,q,.test.bdefres3:async.deferred[h;(`f;1)],1,,testing async.deferred call that should fail on one server -true,0,0,q,10b ~ .test.bdefres3[0;],1,,async.deferred call failed on one server with expected result - -comment,,,,,,,Testing async.postback -run,0,0,q,".test.bpbrestab:([]handle:();time:();result:())",1,,define table .test.bpbrestab to store results from async.postback -run,0,0,q,".test.storeresult:{`.test.bpbrestab upsert (.z.w;.z.t;enlist x)}",1,,define a function .test.storeresult to store the posted back results in .test.bpbrestab -run,0,0,q,async.postback[h;({x+1};2);`.test.storeresult],1,,testing async.postback that should execute on both servers -run,0,0,q,@[;"";()] each h,1,,wait for server response -true,0,0,q,(enlist 3;enlist 3) ~ -2#exec result from .test.bpbrestab,1,,successful async.postback with expected result -run,0,0,q,async.postback[h;({x+`a};2);`.test.storeresult],1,,testing async.postback call that should fail on both servers -run,0,0,q,@[;"";()] each h,1,,wait for server response -true,0,0,q,all all (exec result from -2#.test.bpbrestab) like\: "error*",1,,async.postback call failed on both servers with expected result -run,0,0,q,async.postback[h;(`f;1);`.test.storeresult],1,,testing async.postback call that should fail on one server -run,0,0,q,@[;"";()] each h,1,,wait for server response -true,0,0,q,(enlist 2;enlist "error: server fail: f") ~ exec result from -2#.test.bpbrestab,1,,async.postback call failed on one server with expected result - -run,0,0,q,@[;"exit 0";()] each neg h,,1,,closing remaining server process \ No newline at end of file diff --git a/di/async/async.md b/di/asyncutil/asyncutil.md similarity index 88% rename from di/async/async.md rename to di/asyncutil/asyncutil.md index aadb31fd..9b0f159a 100644 --- a/di/async/async.md +++ b/di/asyncutil/asyncutil.md @@ -22,28 +22,28 @@ If either of these are carried out via asynchronous broadcast, the request will Note, in each of the examples below handles is a list of two handles to different server processes -##### async.deferred +##### asyncutil.deferred Can be used to make deferred synchronous calls via asynchronous broadcast. It will send the query down each of the handles, then block and wait on the handles The result set is of the form (successvector each handle; result vector) Note, that if there is an issue with any of the handles, the query won't be sent down any handle ```q -// async.deferred[handles;query] -q)async.deferred[handles;"2+2"] +// asyncutil.deferred[handles;query] +q)asyncutil.deferred[handles;"2+2"] 1 1 4 4 ``` -##### async.postback +##### asyncutil.postback Can be used to make asynchronous postback calls via asynchronous broadcast. Wrap the supplied query in a postback function Don't block the handle when waiting Success vector is returned that it has been sent correctly The result is then returned once executed by the server, although it is not wrapped in the status -Similar to async.deferred, if there is an issue with any of the handles, the query won't be sent down any handle +Similar to asyncutil.deferred, if there is an issue with any of the handles, the query won't be sent down any handle ```q -// async.postback[handles;query;postback] -q)async.postback[handles;"2+2";{show x}] +// asyncutil.postback[handles;query;postback] +q)asyncutil.postback[handles;"2+2";{show x}] 11b 4 4 diff --git a/di/async/async.q b/di/asyncutil/asyncutil.q similarity index 100% rename from di/async/async.q rename to di/asyncutil/asyncutil.q diff --git a/di/async/init.q b/di/asyncutil/init.q similarity index 63% rename from di/async/init.q rename to di/asyncutil/init.q index 1455cbcb..d0950d9a 100644 --- a/di/async/init.q +++ b/di/asyncutil/init.q @@ -1,3 +1,3 @@ -\l ::async.q +\l ::asyncutil.q export:([deferred;postback]) \ No newline at end of file diff --git a/di/asyncutil/test.csv b/di/asyncutil/test.csv new file mode 100644 index 00000000..791466ba --- /dev/null +++ b/di/asyncutil/test.csv @@ -0,0 +1,27 @@ +action,ms,bytes,lang,code,repeat,minver,comment +before,0,0,q,asyncutil:use`di.asyncutil,1,1,load module into session + +comment,,,,,,,Testing asyncutil.deferred +run,0,0,q,.test.bdefres1:asyncutil.deferred[h;({x+1};1)],1,,testing asyncutil.deferred call that should execute on both servers +true,0,0,q,.test.bdefres1~((1b;1b);(2;2)),1,,successful asyncutil.deferred call with expected result +run,0,0,q,.test.bdefres2:asyncutil.deferred[h;({x+`a};1)],1,,testing asyncutil.deferred call that should fail +true,0,0,q,not any .test.bdefres2[0;],1,,asyncutil.deferred call failed on both servers with expected result +run,0,0,q,.test.bdefres3:asyncutil.deferred[h;(`f;1)],1,,testing asyncutil.deferred call that should fail on one server +true,0,0,q,10b ~ .test.bdefres3[0;],1,,asyncutil.deferred call failed on one server with expected result +run,0,0,q,.test.bdefres3:asyncutil.deferred[h;(`f;1)],1,,testing asyncutil.deferred call that should fail on one server +true,0,0,q,10b ~ .test.bdefres3[0;],1,,asyncutil.deferred call failed on one server with expected result + +comment,,,,,,,Testing asyncutil.postback +run,0,0,q,".test.bpbrestab:([]handle:();time:();result:())",1,,define table .test.bpbrestab to store results from asyncutil.postback +run,0,0,q,".test.storeresult:{`.test.bpbrestab upsert (.z.w;.z.t;enlist x)}",1,,define a function .test.storeresult to store the posted back results in .test.bpbrestab +run,0,0,q,asyncutil.postback[h;({x+1};2);`.test.storeresult],1,,testing asyncutil.postback that should execute on both servers +run,0,0,q,@[;"";()] each h,1,,wait for server response +true,0,0,q,(enlist 3;enlist 3) ~ -2#exec result from .test.bpbrestab,1,,successful asyncutil.postback with expected result +run,0,0,q,asyncutil.postback[h;({x+`a};2);`.test.storeresult],1,,testing asyncutil.postback call that should fail on both servers +run,0,0,q,@[;"";()] each h,1,,wait for server response +true,0,0,q,all all (exec result from -2#.test.bpbrestab) like\: "error*",1,,asyncutil.postback call failed on both servers with expected result +run,0,0,q,asyncutil.postback[h;(`f;1);`.test.storeresult],1,,testing asyncutil.postback call that should fail on one server +run,0,0,q,@[;"";()] each h,1,,wait for server response +true,0,0,q,(enlist 2;enlist "error: server fail: f") ~ exec result from -2#.test.bpbrestab,1,,asyncutil.postback call failed on one server with expected result + +run,0,0,q,@[;"exit 0";()] each neg h,,1,,closing remaining server process diff --git a/main.zip b/main.zip new file mode 100644 index 00000000..dd741ee8 Binary files /dev/null and b/main.zip differ