Skip to content

Commit

Permalink
Making progress testing parallel db with ssh support
Browse files Browse the repository at this point in the history
  • Loading branch information
mkromberg committed Sep 29, 2016
1 parent 655dfc6 commit 60cb4cb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 25 deletions.
4 changes: 2 additions & 2 deletions APLProcess.dyalog
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
:Trap 6
source'(⊃⊃⎕CLASS ⎕THIS).SALT_Data.SourceFile' ⍎ works around a bug
:Else
source(⊃⊃⎕CLASS ⎕THIS).SALT_Data.SourceFile
:If 0=source{((¨)⊃⊃⎕CLASS ⎕THIS),''}5177
source⎕WSID
:Else source4source
Expand Down Expand Up @@ -71,7 +70,8 @@
psi.WindowStyleDiagnostics.ProcessWindowStyle.Minimized
ProcDiagnostics.Process.Start psi
:Else Unix
:If IsSsh326=⎕DR Exe
:If IsSsh326=⎕DR Exe
∘∘∘
ProcSshProc Exe
:Else
pid_SH'{ ',args,' ',Exe,' +s ',ws,' -c APLppid=',(GetCurrentProcessId),' </dev/null >/dev/null 2>&1 & } ; echo $!'
Expand Down
2 changes: 2 additions & 0 deletions BootServers.dyalog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Start a vecdb server process if VECDBSRV="config.json" PORT=nnnn
vecdb slave process if VECDBSLAVE="file" SHARDS="n" PORT=nnnn

'Command Line:'
2 ⎕NQ'.' 'GetCommandLine'
getenv{0=r2 ⎕NQ'.' 'GetEnvironment': r}
getnum{2⎕VFI }
path'file://',⎕NPARTS ⎕WSID
Expand Down
17 changes: 6 additions & 11 deletions TestVecdbSrv.dyalog
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
:Trap 22 {}#.vecdb.Delete folder :EndTrap
⎕MKDIR folder

:If 0=⎕NC '#.PASS'
'Enter password from mkrom@Mortens-Macbook-Air: '
#.PASS
:EndIf

--- Create configuration file ---

configCreateBenchConfig folder,'config.json'
Expand Down Expand Up @@ -85,11 +80,11 @@
##.APLProcess.NewSshClient '192.168.17.129' 'mkrom' 'c:\docs\personal\macbook-air' cmd

configCreateBenchConfig filename;db;config;user;vecdbsrv;cmd;host;keyfile
configCreateBenchConfig filename;db;config;user;vecdbsrv;cmd;host;keyfile;userid
cmd'RIDE_INIT=SERVE::5678 /Applications/Dyalog-15.0.app/Contents/Resources/Dyalog/mapl'
cmd'RIDE_SPAWNED=1 RIDE_INIT=SERVE::5678 /Applications/Dyalog-15.0.app/Contents/Resources/Dyalog/mapl'
host'Mortens-Macbook-Air'
user'mkrom'
userid'mkrom'
keyfile'c:\docs\personal\macbook_air'

user⎕NS ''
Expand All @@ -102,7 +97,7 @@
db.Slaves⎕NS¨2''
db.Slaves.Shards,¨1 2 Distribution of shards to slave processors
db.Slaves[1].(Launch⎕NS '').Type'local'
db.Slaves[2].(Launch⎕NS '').(Type Host User KeyFile Cmd)'ssh' host user keyfile cmd
db.Slaves[2].(Launch⎕NS '').(Type Host User KeyFile Cmd)'ssh' host userid keyfile cmd
config⎕NS''
config.Servervecdbsrv
config.DBs,db
Expand Down Expand Up @@ -134,7 +129,7 @@

options⎕NS''
options.BlockSize10000
options.ShardFolders(folder,'Shard'),¨'12'
options.ShardFolders(folder,'Shard1') '\\Mortens-Macbook-Air\vecdb\Shard2'
options.(ShardFn ShardCols)'{2-2|⎕UCS ⊃¨⊃⍵}' 1

paramsname folder columns types options data
Expand All @@ -148,8 +143,8 @@
data('IBM' 'AAPL' 'MSFT' 'GOOG' 'DYALOG')(160.97 112.6 47.21 531.23 999.99)(5'Buy' 'Sell')

options⎕NS''
options.BlockSize10000
options.ShardFolders(folder,'Shard'),¨'12'
options.BlockSize10000
options.(ShardFn ShardCols)'{2-2|⎕UCS ⊃¨⊃⍵}' 1

paramsname folder columns types options data
Expand Down
29 changes: 17 additions & 12 deletions vecdb.dyalog
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
(⎕IO ⎕ML)1 1

:Section Constants
:Field Public Shared Version'0.2.5' Added ability to use Calculated columns
:Field Public Shared Version'0.2.6' Parallel DB
:Field Public Shared TypeNames,¨'I1' 'I2' 'I4' 'F' 'B' 'C'
To come: C4=323 indexed chars
Tn=Fixed with text (no index table)
Expand Down Expand Up @@ -348,10 +348,10 @@

:For i :In newchars/newcols Create symbol files for CHAR fields
colimappings
dixnewcolsi data index
dixnewcolsi data index
col.symbol{[]}dixdata Unique symbols in input data
col.filefolder,(i),'.symbol' Symbol file name in main folder
col.symbol PutSymbols col.file Read symbols
col.symbol PutSymbols col.file Read symbols
col.(SymbolIndexsymbol) Create lookup function
(dixdata)col.SymbolIndex dixdata Convert indices
:EndFor
Expand All @@ -377,8 +377,8 @@
⎕NUNTIE tn
:EndIf

:For i :In newcols For each column being added
ai3ai[3]
:For i :In newcols For each column being added
ai3AI[3]
dr(TypeNames_Types[i])TypeNums
tn(filenamesf,(i),'.vector')⎕NCREATE 0
(sizeOf size dr)⎕NRESIZE tn
Expand Down Expand Up @@ -460,7 +460,7 @@
(offset+sizeOf count dr)⎕NRESIZE tn Extend the file
⎕NUNTIE tn
ncol.vectordr ¯1 ⎕MAP col.file'W' Re-establish map
col.vector[(n-count)+count]countidata update with new data
col.vector[(n-count)+count]countidata update with new data
:EndFor

Expand Down Expand Up @@ -812,7 +812,7 @@
r0

rDelete folder;file;tn;folders;files;f
rDelete folder;file;tn;folders;files;f;shards
:Access Public Shared
Erase a vecdb file without opening it first (it might be too damaged to open)
Does check whether there is a meta file in the folder
Expand All @@ -821,12 +821,17 @@
folderAddSlash folder
'Folder not found'⎕SIGNAL(DirExists folder)22 Not there
'Not a vecdb'⎕SIGNAL(Exists filefolder,'meta.vecdb')22 Paranoia
tnfile ⎕FTIE 0
folders(⎕FREAD tn 6),folder shards first
file ⎕FERASE tn

:If isWindows
⎕CMD'rmdir "',folder,'" /s /q'
:Else
1 _SH'rm -r ',folder
:EndIf
:For folder :In folders
:If isWindows
⎕CMD'rmdir "',folder,'" /s /q'
:Else
1 _SH'rm -r ',folder
:EndIf
:EndFor

r~DirExists folder
Expand Down

0 comments on commit 60cb4cb

Please sign in to comment.