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 29, 2018
1 parent bd835a5 commit 027d3fd
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 37 deletions.
3 changes: 1 addition & 2 deletions contractCalls/setJobStatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@

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]);
startTime = int(sys.argv[4]);

tx = eBlocBroker.transact({"from":web3.toChecksumAddress(constants.CLUSTER_ID), "gas": 4500000}).setJobStatus(jobKey, index, stateID, startTime);
print(tx.hex());
#}
12 changes: 7 additions & 5 deletions eBlocBrokerHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down Expand Up @@ -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);
};
*/
20 changes: 4 additions & 16 deletions eBlocBrokerNodeCall.js
Original file line number Diff line number Diff line change
@@ -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] );
}

18 changes: 9 additions & 9 deletions endCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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();
#}

Expand Down Expand Up @@ -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
#}

Expand Down
8 changes: 3 additions & 5 deletions startCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);
#}
Expand Down

0 comments on commit 027d3fd

Please sign in to comment.