diff --git a/contractCalls/setJobStatus.py b/contractCalls/setJobStatus.py index ccb68ec9..56e9601e 100755 --- a/contractCalls/setJobStatus.py +++ b/contractCalls/setJobStatus.py @@ -23,7 +23,7 @@ contractAddress = web3.toChecksumAddress(contractAddress); eBlocBroker = web3.eth.contract(contractAddress, abi=abi); -# USER Inputs---------------------------------------------------------------- + jobKey = str(sys.argv[1]); index = int(sys.argv[2]); stateID = int(sys.argv[3]); @@ -31,4 +31,3 @@ tx = eBlocBroker.transact({"from":web3.toChecksumAddress(constants.CLUSTER_ID), "gas": 4500000}).setJobStatus(jobKey, index, stateID, startTime); print(tx.hex()); -#} diff --git a/eBlocBrokerHeader.js b/eBlocBrokerHeader.js index 5d226f12..256446c0 100755 --- a/eBlocBrokerHeader.js +++ b/eBlocBrokerHeader.js @@ -51,11 +51,6 @@ exports.getJobInfo = function(var1, var2, var3) { return myContractInstance.getJobInfo(var1, var2, var3); }; -exports.setJobStatus = function(var1, var2, var3, var4) { - hash = myContractInstance.setJobStatus(var1, var2, var3, var4, {from: web3.eth.defaultAccount, gas: gasLimit }); - console.log(hash); -}; - exports.getDeployedBlockNumber = function() { return myContractInstance.getDeployedBlockNumber(); }; @@ -313,3 +308,10 @@ exports.isTransactionPassed = function(transaction_id) { //console.log( checkPassed ); return checkPassed; }; + +/* +exports.setJobStatus = function(var1, var2, var3, var4) { + hash = myContractInstance.setJobStatus(var1, var2, var3, var4, {from: web3.eth.defaultAccount, gas: gasLimit }); + console.log(hash); +}; +*/ diff --git a/eBlocBrokerNodeCall.js b/eBlocBrokerNodeCall.js index 32b7c202..045e7311 100755 --- a/eBlocBrokerNodeCall.js +++ b/eBlocBrokerNodeCall.js @@ -1,20 +1,8 @@ -var nodePaths = require('./nodePaths'); +var nodePaths = require('./nodePaths'); var eBlocBroker = require(nodePaths.EBLOCBROKER + '/eBlocBrokerHeader.js'); +const args = process.argv; -const args = process.argv; - -var setJobStatus = "setJobStatus" -var val = args[2]; - -if( args[2].toString() == "setJobStatus" ){ - eBlocBroker.setJobStatus(args[3], args[4], args[5], args[6]); -} -else if( args[2].toString() == "getJobInfo" ){ - console.log('' + eBlocBroker.getJobInfo( args[3], args[4], args[5] )); -} -else if( args[2].toString() == "receiptCheck" ){ +if( args[2].toString() == "receiptCheck" ){ eBlocBroker.receiptCheck(args[3], args[4], args[5], args[6], args[7], args[8]); } -else if( args[2].toString() == "bs58_encode" ){ - eBlocBroker.bs58_encode( args[3] ); -} + diff --git a/endCode.py b/endCode.py index a00b240e..ef33d4e3 100755 --- a/endCode.py +++ b/endCode.py @@ -19,21 +19,22 @@ def log(strIn, color=''): #{ txFile.close(); #} -def receiptCheckTx(): #{ - transactionHash = os.popen('node $eblocPath/eBlocBrokerNodeCall.js receiptCheck $jobKey $index $elapsedRawTime $newHash $storageID $endTimeStamp').read().rstrip('\n').replace(" ", ""); +def receiptCheckTx(jobKey, index): #{ + txHash = os.popen('node $eblocPath/eBlocBrokerNodeCall.js receiptCheck $jobKey $index $elapsedRawTime $newHash $storageID $endTimeStamp').read().rstrip('\n').replace(" ", ""); while(True): #{ - if not(transactionHash == "notconnected" or transactionHash == ""): + if not(txHash == "notconnected" or txHash == ""): break; else: log("Error: Please run Parity or Geth on the background.", 'red') - transactionHash = os.popen('node $eblocPath/eBlocBrokerNodeCall.js receiptCheck $jobKey $index $elapsedRawTime $newHash $storageID $endTimeStamp').read().rstrip('\n').replace(" ", ""); + txHash = os.popen('node $eblocPath/eBlocBrokerNodeCall.js receiptCheck $jobKey $index $elapsedRawTime $newHash $storageID $endTimeStamp').read().rstrip('\n').replace(" ", ""); time.sleep(5); #} - log("ReceiptHash: " + transactionHash); - txFile = open(constants.LOG_PATH + '/transactions/' + constants.CLUSTER_ID + '.txt', 'a'); - txFile.write(transactionHash + " receiptCheckTx\n"); + log("ReceiptHash: " + txHash); + txFile = open(constants.LOG_PATH + '/transactions/' + constants.CLUSTER_ID + '.txt', 'a'); + + txFile.write(jobKey + "_" + index + "| Tx: " + txHash + "| receiptCheckTx\n"); txFile.close(); #} @@ -301,8 +302,7 @@ def endCall(jobKey, index, storageID, shareToken, folderName): #{ sys.exit(); #} - receiptCheckTx(); - + receiptCheckTx(jobKey, index); # os.system("rm -rf " + programPath + '/' + jobKey + "_" + index); # Deleted downloaded code from local since it is not needed anymore #} diff --git a/startCode.py b/startCode.py index cb5773a3..82791400 100755 --- a/startCode.py +++ b/startCode.py @@ -27,10 +27,9 @@ def startCall(jobKey, index): #{ txFile.close(); time.sleep(0.25); - # txHash = os.popen('$contractCallPath/setJobStatus.py $jobKey $index $statusId $unixTime').read().rstrip('\n'); - txHash = os.popen('node $eblocPath/eBlocBrokerNodeCall.js setJobStatus $jobKey $index $statusId $unixTime').read().rstrip('\n').replace(" ", ""); txFile = open(constants.LOG_PATH + '/transactions/' + constants.CLUSTER_ID + '.txt', 'a'); - + txHash = os.popen('$eblocPath/venv/bin/python3 $contractCallPath/setJobStatus.py $jobKey $index $statusId $unixTime').read().rstrip('\n'); + countTry = 0; while True: #{ if countTry > 10: @@ -41,8 +40,7 @@ def startCall(jobKey, index): #{ break; else: os.environ['unixTime'] = unixTime; - # txHash = os.popen('$contractCallPath/setJobStatus.py $jobKey $index $statusId $unixTime').read().rstrip('\n'); - txHash = os.popen('node $eblocPath/eBlocBrokerNodeCall.js setJobStatus $jobKey $index $statusId $unixTime').read().rstrip('\n').replace(" ", ""); + txHash = os.popen('$eblocPath/venv/bin/python3 $contractCallPath/setJobStatus.py $jobKey $index $statusId $unixTime').read().rstrip('\n'); txFile.write(jobKey + "_" + index + "| Try: " + str(countTry) + '\n'); time.sleep(5); #}