From 808f8576590c11599d22849a87e109b1960eed31 Mon Sep 17 00:00:00 2001 From: cortze Date: Fri, 4 Aug 2023 10:28:48 +0200 Subject: [PATCH] add cortze/py-dht as submodule + add DHT related parameters to the DAS conf/shape --- .gitignore | 1 + .gitmodules | 3 +++ README.md | 2 +- install_dependencies.sh | 20 ++++++++++++++++++++ py-dht | 1 + smallConf.py | 22 +++++++++++++++++++--- 6 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 .gitmodules create mode 100644 install_dependencies.sh create mode 160000 py-dht diff --git a/.gitignore b/.gitignore index 43965e8..4d7b16e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ myenv*/ doc/_build !results/plots.py Frontend/ +.idea diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..72c9918 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "py-dht"] + path = py-dht + url = https://github.com/cortze/py-dht.git diff --git a/README.md b/README.md index d158e01..4ddf7a9 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ cd das-research ``` python3 -m venv myenv source myenv/bin/activate -pip3 install -r DAS/requirements.txt +bash install_dependencies.sh ``` ## Run the simulator diff --git a/install_dependencies.sh b/install_dependencies.sh new file mode 100644 index 0000000..079bb39 --- /dev/null +++ b/install_dependencies.sh @@ -0,0 +1,20 @@ +VENV="./myenv" + +echo "Installing dependencies for DAS..." + +# activate the venv or raise error if error +source $VENV/bin/activate +if [ $? -eq 0 ]; then + echo "venv successfully sourced" +else + echo "unable to source venv at $VENV , does it exist?" + exit 1 +fi + +# make sure that the submodule module is correctly downloaded +git submodule update --init + +# install requirements for DAS and py-dht and install the dht module from py-dht +pip3 install -r DAS/requirements.txt +pip3 install -r py-dht/requirements.txt +pip3 install -e py-dht diff --git a/py-dht b/py-dht new file mode 160000 index 0000000..3f7d754 --- /dev/null +++ b/py-dht @@ -0,0 +1 @@ +Subproject commit 3f7d75451905b7bd9e6207a1168b3086b244f890 diff --git a/smallConf.py b/smallConf.py index 7ab3f44..f2eef5d 100644 --- a/smallConf.py +++ b/smallConf.py @@ -101,10 +101,26 @@ diagnostics = False # True to save git diff and git commit saveGit = False +# --- DHT Parameters --- + +# True to simulate the distribution of the BlockSegments over a simulated DHTNetwork +dhtSimulation = True + +# K replication factor, in how many DHT nodes are we going to store the block segments +# reused as how many DHT nodes will fit into each Kbucket to the routing table +ks = [20] + +# Number of concurrent DHT nodes that will be contacted during a Lookup +alphas = [1] + +# Number of steps without finding any closer DHT nodes to a Hash will the DHT lookup perform before finishing it +# Not using steps4StopCondition as 7 steps looks too much for the DHT (although it could be changed :)) +nilStepsToStopLookup = 3 + def nextShape(): - for run, fm, fr, class1ratio, chi, vpn1, vpn2, blockSize, nn, netDegree, bwUplinkProd, bwUplink1, bwUplink2 in itertools.product( - runs, failureModels, failureRates, class1ratios, chis, validatorsPerNode1, validatorsPerNode2, blockSizes, numberNodes, netDegrees, bwUplinksProd, bwUplinks1, bwUplinks2): + for run, fm, fr, class1ratio, chi, vpn1, vpn2, blockSize, nn, netDegree, bwUplinkProd, bwUplink1, bwUplink2, k, alpha in itertools.product( + runs, failureModels, failureRates, class1ratios, chis, validatorsPerNode1, validatorsPerNode2, blockSizes, numberNodes, netDegrees, bwUplinksProd, bwUplinks1, bwUplinks2, ks, alphas): # Network Degree has to be an even number if netDegree % 2 == 0: - shape = Shape(blockSize, nn, fm, fr, class1ratio, chi, vpn1, vpn2, netDegree, bwUplinkProd, bwUplink1, bwUplink2, run) + shape = Shape(blockSize, nn, fm, fr, class1ratio, chi, vpn1, vpn2, netDegree, bwUplinkProd, bwUplink1, bwUplink2, k, alpha, run) yield shape