Skip to content

Commit

Permalink
more update.
Browse files Browse the repository at this point in the history
  • Loading branch information
avatar-lavventura committed Apr 9, 2018
1 parent 7f2b7e7 commit 732711b
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 37 deletions.
3 changes: 1 addition & 2 deletions Driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def isSlurmOn():

if not blockReadFromLocal.isdigit(): #{
logTest("Error: constants.BLOCK_READ_FROM_FILE is empty or contains and invalid value", "")
logTest("> Would you like to read from contract's deployed block number? y/n", "")

logTest("> Would you like to read from contract's deployed block number? y/n", "")
while True: #{
choice = input().lower()
if choice in yes:
Expand Down
10 changes: 6 additions & 4 deletions clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ rm -f *.pyc
rm -f checkSinfoOut.txt
rm -f .node-xmlhttprequest*
rm -f *.*~
rm -rf docs/_build
rm -f docs/*.*~
rm -f docs/nohup.out
rm -rf docs/_build_html
rm -rf docs/__pycache__
rm -rf contract/tests/__pycache__
rm -f nohup.out
rm -f ./docs/solidity_lexer.pyc
rm -f contractCalls/*.*~
rm -f ipfs.out
rm -rf docs/_build_html
rm -rf docs/__pycache__
rm -rf contract/tests/__pycache__
rm -rf __pycache__/
rm -rf docs/_build

pyclean docs/

Expand Down
29 changes: 18 additions & 11 deletions endCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
jobKeyGlobal = "";
indexGlobal = "";

def logTest(strIn):
def logTest(strIn): #{
print(strIn);
txFile = open(constants.LOG_PATH + '/endCodeAnalyse/' + jobKeyGlobal + "_" + indexGlobal + '.txt', 'a');
txFile.write(strIn + "\n");
txFile.close();

def endCall(jobKey, index, storageType, shareToken, miniLockId, folderName):
#}

def endCall(jobKey, index, storageType, shareToken, miniLockId, folderName): #{
endTimeStamp = os.popen('date +%s').read();

global jobKeyGlobal; jobKeyGlobal = jobKey
Expand Down Expand Up @@ -79,8 +80,13 @@ def endCall(jobKey, index, storageType, shareToken, miniLockId, folderName):

logTest("0: " + jobInfo[0])
logTest("1: " + jobInfo[2])


countTry = 0;
while True: #{
if countTry > 10:
sys.exit()
countTry = countTry + 1

logTest(jobInfo[0]);
logTest(jobInfo[2]);

Expand Down Expand Up @@ -112,7 +118,7 @@ def endCall(jobKey, index, storageType, shareToken, miniLockId, folderName):
os.environ['jobId'] = jobId;
logTest("JOBID ------------> " + str(jobId));

# Here we know that job is already completed
# Here we know that job is already completed ----------------
if str(storageType) == '0' or str(storageType) == '3': #{
countTry = 0;
while(True):
Expand All @@ -137,7 +143,7 @@ def endCall(jobKey, index, storageType, shareToken, miniLockId, folderName):
break
#}

if str(storageType) == '2':
if str(storageType) == '2': #{
encrypyFolderPath = programPath + "/" + jobKey + "_" + index;
os.environ['encrypyFolderPath'] = encrypyFolderPath
logTest("encrypyFolderPath: " + encrypyFolderPath)
Expand All @@ -152,9 +158,9 @@ def endCall(jobKey, index, storageType, shareToken, miniLockId, folderName):

countTry = 0;
while(True):
if (countTry > 10):
if countTry > 10:
sys.exit()
countTry = countTry + 1
countTry = countTry + 1;

newHash = os.popen('ipfs add $encrypyFolderPath/result.tar.gz.minilock').read();
logTest("newHash: " + newHash)
Expand All @@ -168,7 +174,8 @@ def endCall(jobKey, index, storageType, shareToken, miniLockId, folderName):
os.environ['newHash'] = newHash;
logTest("newHash: " + newHash);
break;

#}

logTest("jobId: " + jobId);
elapsedTime = os.popen('sacct -j $jobId --format="Elapsed" | tail -n1 | head -n1').read();
logTest("ElapsedTime: " + elapsedTime);
Expand Down Expand Up @@ -205,7 +212,7 @@ def endCall(jobKey, index, storageType, shareToken, miniLockId, folderName):
transactionHash = os.popen('node $eblocPath/eBlocBrokerNodeCall.js receiptCheck $jobKey $index $elapsedRawTime $newHash $storageType $endTimeStamp').read().rstrip('\n').replace(" ", "");
time.sleep(5)
elif storageType == '1': #{
nullByte="0x00"; os.environ['nullByte'] = nullByte;
os.environ['nullByte'] = "0x00";
transactionHash = os.popen('node $eblocPath/eBlocBrokerNodeCall.js receiptCheck $jobKey $index $elapsedRawTime $nullByte $storageType $endTimeStamp').read().rstrip('\n').replace(" ", "");
while(True):
if (not(transactionHash == "notconnected" or transactionHash == "")):
Expand Down Expand Up @@ -233,9 +240,9 @@ def endCall(jobKey, index, storageType, shareToken, miniLockId, folderName):
txFile = open(constants.LOG_PATH + '/transactions/' + clusterID + '.txt', 'a');
txFile.write(transactionHash + " end_receiptCheck\n");
txFile.close();
#}

if __name__ == '__main__': #{
#jobKey, index, storageType, shareToken, miniLockId, folderName
jobKey = sys.argv[1];
index = sys.argv[2];
storageType = sys.argv[3];
Expand Down
2 changes: 1 addition & 1 deletion initialize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pre-installation:-----------------------------------------

## Python 3.5.2
## Python 3.5.2 # not-nessesary.
# cd /usr/src
# sudo curl -O https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
# sudo tar xzf Python-3.5.2.tgz
Expand Down
1 change: 1 addition & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash

source ~/.venv-py3/bin/activate
python Driver.py
10 changes: 4 additions & 6 deletions runSlurm.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/bin/bash
# To Run: sudo bash runSlurm.sh
# To Run: sudo bash runSlurm.sh
#------------------------------

sudo killall slurmctld slurmdbd slurmd

sudo slurmd
sudo munged -f
sudo /etc/init.d/munge start
sudo slurmd
slurmdbd &
mkdir -p /tmp/slurmstate

slurmctld -c
#slurmctld -cDvvvvvv
sudo -u $(logname) mkdir -p /tmp/slurmstate
slurmctld -c #-cDvvvvvv
sinfo
23 changes: 10 additions & 13 deletions startCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,32 @@

import sys, os, constants, time

def startCall( jobKey, index ):
clusterID = constants.CLUSTER_ID;
eblocPath = constants.EBLOCPATH;
logPath = constants.LOG_PATH;

os.environ['eblocPath'] = eblocPath;
def startCall( jobKey, index ): #{
os.environ['eblocPath'] = constants.EBLOCPATH;
os.environ['index'] = str(index);
os.environ['jobKey'] = jobKey;
statusId = str(constants.job_state_code['RUNNING']);
os.environ['statusId'] = statusId;
unixTime = os.popen('date +%s').read();
unixTime = str(int(unixTime) + 1);
unixTime = str(int(os.popen('date +%s').read()) + 1);
os.environ['unixTime'] = unixTime;

txHash = os.popen('node $eblocPath/eBlocBrokerNodeCall.js setJobStatus $jobKey $index $statusId $unixTime').read().rstrip('\n').replace(" ", "");

while(True):
if (not(txHash == "notconnected" or txHash == "")):
if not(txHash == "notconnected" or txHash == ""):
break;
else:
os.environ['unixTime'] = unixTime;
txHash = os.popen('node $eblocPath/eBlocBrokerNodeCall.js setJobStatus $jobKey $index $statusId $unixTime').read().rstrip('\n').replace(" ", "");
txHash = os.popen('node $eblocPath/eBlocBrokerNodeCall.js setJobStatus $jobKey $index $statusId $unixTime').read().rstrip('\n').replace(" ", "");
time.sleep(5);

txFile = open(logPath + '/transactions/' + clusterID + '.txt', 'a');
txFile = open(constants.LOG_PATH + '/transactions/' + constants.CLUSTER_ID + '.txt', 'a');
txFile.write(txHash + " setJobStatus_started" + " " + unixTime + "\n");
txFile.close();

if __name__ == '__main__':
#}

if __name__ == '__main__': #{
jobKey = sys.argv[1];
index = sys.argv[2];
startCall(jobKey, index);
#}

0 comments on commit 732711b

Please sign in to comment.