mirror of https://github.com/skygpu/skynet.git
Make new non_compete optional, also ipfs_gateway
parent
b7b267a71b
commit
7cd539a944
|
@ -27,7 +27,10 @@ class SkynetDGPUDaemon:
|
||||||
config['auto_withdraw']
|
config['auto_withdraw']
|
||||||
if 'auto_withdraw' in config else False
|
if 'auto_withdraw' in config else False
|
||||||
)
|
)
|
||||||
self.non_compete = set(config['non_compete'])
|
|
||||||
|
self.non_compete = set()
|
||||||
|
if 'non_compete' in config:
|
||||||
|
self.non_compete = set(config['non_compete'])
|
||||||
|
|
||||||
self.model_whitelist = set()
|
self.model_whitelist = set()
|
||||||
if 'model_whitelist' in config:
|
if 'model_whitelist' in config:
|
||||||
|
|
|
@ -47,7 +47,9 @@ class SkynetGPUConnector:
|
||||||
self.cleos = CLEOS(
|
self.cleos = CLEOS(
|
||||||
None, None, self.node_url, remote=self.node_url)
|
None, None, self.node_url, remote=self.node_url)
|
||||||
|
|
||||||
self.ipfs_gateway_url = config['ipfs_gateway_url']
|
self.ipfs_gateway_url = None
|
||||||
|
if 'ipfs_gateway_url' in config:
|
||||||
|
self.ipfs_gateway_url = config['ipfs_gateway_url']
|
||||||
self.ipfs_url = config['ipfs_url']
|
self.ipfs_url = config['ipfs_url']
|
||||||
|
|
||||||
self.ipfs_client = AsyncIPFSHTTP(self.ipfs_url)
|
self.ipfs_client = AsyncIPFSHTTP(self.ipfs_url)
|
||||||
|
@ -202,11 +204,12 @@ class SkynetGPUConnector:
|
||||||
img = Image.open(io.BytesIO(raw_img))
|
img = Image.open(io.BytesIO(raw_img))
|
||||||
img.save('ipfs-staging/image.png')
|
img.save('ipfs-staging/image.png')
|
||||||
|
|
||||||
# check peer connections, reconnect to skynet gateway if not
|
if self.ipfs_gateway_url:
|
||||||
gateway_id = Path(self.ipfs_gateway_url).name
|
# check peer connections, reconnect to skynet gateway if not
|
||||||
peers = await self.ipfs_client.peers()
|
gateway_id = Path(self.ipfs_gateway_url).name
|
||||||
if gateway_id not in [p['Peer'] for p in peers]:
|
peers = await self.ipfs_client.peers()
|
||||||
await self.ipfs_client.connect(self.ipfs_gateway_url)
|
if gateway_id not in [p['Peer'] for p in peers]:
|
||||||
|
await self.ipfs_client.connect(self.ipfs_gateway_url)
|
||||||
|
|
||||||
file_info = await self.ipfs_client.add(Path('ipfs-staging/image.png'))
|
file_info = await self.ipfs_client.add(Path('ipfs-staging/image.png'))
|
||||||
file_cid = file_info['Hash']
|
file_cid = file_info['Hash']
|
||||||
|
|
Loading…
Reference in New Issue