mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-28 11:18:19 +08:00
BLD: check for existence of dataset in ingestion & subscription
This commit is contained in:
@@ -213,11 +213,18 @@ class Marketplace:
|
||||
|
||||
def subscribe(self, dataset):
|
||||
|
||||
dataset = dataset.lower()
|
||||
|
||||
address = self.choose_pubaddr()[0]
|
||||
|
||||
dataset_info = self.mkt_contract.functions.getDataSource(
|
||||
bytes32(dataset)).call()
|
||||
|
||||
if not dataset_info[4]:
|
||||
print('The requested "{}" dataset is not registered in '
|
||||
'the Data Marketplace.'.format(dataset))
|
||||
return
|
||||
|
||||
price = dataset_info[1]
|
||||
|
||||
print('\nThe price for a monthly subscription to this dataset is'
|
||||
@@ -364,6 +371,14 @@ class Marketplace:
|
||||
|
||||
dataset = dataset.lower()
|
||||
|
||||
dataset_info = self.mkt_contract.functions.getDataSource(
|
||||
bytes32(dataset)).call()
|
||||
|
||||
if not dataset_info[4]:
|
||||
print('The requested "{}" dataset is not registered in '
|
||||
'the Data Marketplace.'.format(dataset))
|
||||
return
|
||||
|
||||
address, address_i = self.choose_pubaddr()
|
||||
|
||||
check_sub = self.mkt_contract.functions.checkAddressSubscription(
|
||||
@@ -551,6 +566,8 @@ class Marketplace:
|
||||
|
||||
def publish(self, dataset, datadir, watch):
|
||||
|
||||
dataset = dataset.lower()
|
||||
|
||||
datasource = self.mkt_contract.functions.getDataSource(
|
||||
bytes32(dataset)).call()
|
||||
|
||||
@@ -607,4 +624,4 @@ class Marketplace:
|
||||
raise MarketplaceHTTPRequest(request='upload file',
|
||||
error=r.json()['error'])
|
||||
|
||||
print('Dataset {} published successfully.'.format(dataset))
|
||||
print('Dataset {} uploaded successfully.'.format(dataset))
|
||||
|
||||
Reference in New Issue
Block a user