I wrote a shell script to collect data on each character of the alphabet from a large table. As a result of the function being memory intensive, I'd like to partition the characters of the alphabet so that each character is concurrently called using a different port number. However I can't seem to successfully pass the desired command line argument into my function. Testing on a single port and a small table, what I've tried is the following...
On the server: I set up my dummy table and defined a function...
ts:([]sym:1000?`A`Ab`B`Bc`C`Ca`X`Xz`Y`Yx`Z`Zy;price:1000?100.0;num:til 1000)
collect:{[x;y]select from x where sym like y}
On the client: I open a connection handle, use the .z.X namespace to return strings of the raw, unfiltered command line arguments, index into it and store as a variable, and then attempt to pass that variable into my server side function. I've tried storing as a character and a symbol. It will run without error but neither returns any data when called. I save this file as collector.q..
/ start connection handles to remote server
h:hopen `::5000
/ index into command line arguments to get partition letter. Store as character and symbol
part:.z.X[6]
symPart:`$part
/ call server side functions
fetched:h (`collect; `ts; "symPart*")
/ close connection handle
hclose h
my shell script looks like the following...
#!/bin/sh
port=$1
partition=$2
for x in {A..Z}
do
echo running partition $x on port $port
$QHOME/l64/q collector.q -p $port -partition $x > ./stdout$port.log 2>&1 &
port=$(($port + 1))
done
After running the shell script, when calling the fetched function on the client, what's returned is an empty table...
q)fetched
symbol price ID
---------------
q)