Repository navigation
new writedown mode partbyenum and new intraday process #656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Papamaci444
merged 23 commits into
DataIntellectTech:master
from
Papamaci444:partbyenum
Sep 24, 2024
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
a53ad57
added partbyenum writedown mode
Papamaci444 38aa308
new idb process
Papamaci444 100c378
added idb process
Papamaci444 4e792bd
changing EOL to unix
Papamaci444 be88c0b
changed idb logic
Papamaci444 42f8f67
idb notification logging refined
Papamaci444 ec2ab96
createalias refined and added to os.q
Papamaci444 271eba5
addressed comments, removed gmttime, refactored
Papamaci444 4b2f6d1
correcting indentation, removing reload function from idbstandard.q
Papamaci444 e198caa
removing unused server types from wdb
Papamaci444 f53244b
added back comment in processes/wdb.q
Papamaci444 9eb82e4
added hsym to folder parameters
Papamaci444 4f484f6
added testing wdb partbyenum
Papamaci444 c7732cc
added test for idb process, added hsym to hdbdir and wdbdir parmters …
Papamaci444 e6b7fa2
added documentation for partbyenum and idb
Papamaci444 2f8c003
added graphics for idb docs
Papamaci444 a7322a8
Merge remote-tracking branch 'refs/remotes/origin/partbyenum' into pa…
Papamaci444 7da07fc
EOL changed to LF
Papamaci444 b2802f5
IDB is accessible via Gateway
Papamaci444 30c8bab
IDB doesn't fail on restart or empty database
Papamaci444 609cd44
IDB reworked - connects to WDB and registers itself with WDB. IDB has…
Papamaci444 ad06000
WDB refactored to support new writedown mode partbyenum more
Papamaci444 819c400
IDB intraday reload and logging improved. Fixed some comments.
Papamaci444 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| /-default parameters | ||
| \d .idb | ||
|
|
||
| wdbtypes:@[value;wdbtypes;`wdb]; | ||
|
|
||
| /-these parameters are only used once their value has been set with values retrieved from the WBD. | ||
| writedownmode:idbdir:savedir:currentpartition:symfilepath:`; | ||
| symsize:partitionsize:0; | ||
|
|
||
| /-force loads sym file | ||
| loadsym:{[] | ||
| .lg.o[`load;"loading the sym file"]; | ||
| @[load;symfilepath; {.lg.e[`load;"failed to load sym file: ",string[symfilepath]," error: ",x]}]; | ||
| symsize::hcount symfilepath; | ||
| }; | ||
|
|
||
| /-force loads IDB | ||
| loadidb:{[] | ||
| .lg.o[`load;"loading the db"]; | ||
| @[system; "l ", 1_string idbdir; {.lg.e[`load;"failed to load IDB: ",string[idbdir]," error: ",x]}]; | ||
| partitionsize::count key idbdir; | ||
| }; | ||
|
|
||
| /- force loads the idb and the sym file | ||
| loaddb:{[] | ||
| starttime:.proc.ct[]; | ||
| loadsym[]; | ||
| loadidb[]; | ||
| .lg.o[`load;"IDB load has been finished for partition: ",string[currentpartition],". Time taken(ms): ",string .proc.ct[]-starttime]; | ||
| }; | ||
|
|
||
| /- sets current partition and force loads the idb and the sym file. Called by the WDB after EOD. | ||
| rollover:{[pt] | ||
| currentpartition::pt; | ||
| idbdir::.Q.dd[savedir; currentpartition]; | ||
| loaddb[]; | ||
| }; | ||
|
|
||
| /- reloads the db. Called by wdb process midday/eod. | ||
| intradayreload:{[] | ||
| starttime:.proc.ct[]; | ||
| if[symfilehaschanged[];loadsym[]]; | ||
| if[partitioncounthaschanged[];loadidb[]]; | ||
|
Papamaci444 marked this conversation as resolved.
Resolved
|
||
| .lg.o[`intradayreload;"IDB reload has been finished for partition: ",string[savedir],". Time taken(ms): ",string .proc.ct[]-starttime]; | ||
| }; | ||
|
|
||
| /- checks if sym file has changed since last reload of the IDB. Records new sym size if changed. | ||
| symfilehaschanged:{[] | ||
| $[symsize<>c:hcount symfilepath;[symsize::c; 1b];0b] | ||
| }; | ||
|
|
||
| /- checks if count of partitions has changed since last reload of the IDB. Records new partition count if changed. | ||
| /- the default writedown method doesn't need db reloading as no new directory is being created there. | ||
| partitioncounthaschanged:{[] | ||
| if[writedownmode~`default;:0b]; | ||
| $[partitionsize<>c:count key idbdir;[partitionsize::c; 1b];0b] | ||
| }; | ||
|
|
||
| setparametersfromwdb:{[wdbHandle] | ||
| .lg.o[`init;"querying WDB, HDB locations, current partition and writedown mode from WDB"]; | ||
| params:@[wdbHandle; (each;value;`.wdb.savedir`.wdb.hdbdir`.wdb.currentpartition`.wdb.writedownmode); {.lg.e[`connection; "Failed to retrieve values from WDB."]; 'x}]; | ||
| savedir::hsym params[0]; | ||
| currentpartition::params[2]; | ||
| symfilepath::.Q.dd[hsym params[1]; `sym]; | ||
| writedownmode::params[3]; | ||
| idbdir::.Q.dd[savedir; $[writedownmode~`default;`;currentpartition]]; | ||
| .lg.o[`init;"Current settings: db folder: ",string[idbdir],", sym file: ",string[symfilepath],", writedownmode: ", string writedownmode]; | ||
| }; | ||
|
|
||
| init:{[] | ||
| .lg.o[`init; "searching for servers"]; | ||
| .servers.startup[]; | ||
| .lg.o[`init;"getting connection handle to the WDB"]; | ||
| w:.servers.gethandlebytype[wdbtypes;`any]; | ||
| /-exit if no valid handle | ||
| if[0=count w; .lg.e[`connection;"no connection to the WDB could be established... failed to initialise."];:()]; | ||
| .lg.o[`init;"found a WDB process"]; | ||
| /-setting parameters in .idb namespace from WDB | ||
| setparametersfromwdb[w]; | ||
| .lg.o[`init;"loading the db and the sym file first time"]; | ||
| loaddb[]; | ||
| .lg.o[`init;"registering IDBs on WDB process..."]; | ||
| /-send sync message to WDB to register the existing IDBs. | ||
| @[w;(`.servers.registerfromdiscovery;`idb;0b);{.lg.e[`connection;"Failed to register IDB with WDB."];'x}]; | ||
| .lg.o[`init; "Initialisation of the IDB is done."]; | ||
| } | ||
|
|
||
| \d . | ||
|
|
||
| .idb.init[]; | ||
|
|
||
| /- helper function to support queries against the sym column | ||
| maptoint:{[symbol] | ||
| sym?symbol | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.