コード例 #1
0
 def publish_proto_metadata_update(self):
     """ Publish protobuf model in ipfs and update existing metadata file """
     metadata = load_mpe_service_metadata(self.args.metadata_file)
     ipfs_hash_base58 = utils_ipfs.publish_proto_in_ipfs(
         self._get_ipfs_client(), self.args.protodir)
     metadata.set_simple_field("model_ipfs_hash", ipfs_hash_base58)
     metadata.save_pretty(self.args.metadata_file)
コード例 #2
0
    def publish_proto_metadata_init(self):
        model_ipfs_hash_base58 = utils_ipfs.publish_proto_in_ipfs(
            self._get_ipfs_client(), self.args.protodir)

        metadata = MPEServiceMetadata()
        mpe_address = self.get_mpe_address()
        metadata.set_simple_field("model_ipfs_hash",
                                  model_ipfs_hash_base58)
        metadata.set_simple_field("mpe_address",                  mpe_address)
        metadata.set_simple_field("display_name",
                                  self.args.display_name)
        metadata.set_simple_field("encoding",
                                  self.args.encoding)
        metadata.set_simple_field("service_type",
                                  self.args.service_type)

        if self.args.group_name:
            metadata.add_group(self.args.group_name)
            if self.args.endpoints:
                for endpoint in self.args.endpoints:
                    metadata.add_endpoint_to_group(
                        self.args.group_name, endpoint)
            if self.args.fixed_price is not None:
                metadata.set_fixed_price_in_cogs(
                    self.args.group_name, self.args.fixed_price)
        elif self.args.group_name or self.args.fixed_price:
            raise Exception(
                "endpoints / fixed price can be attached to a group please pass group_name")
        metadata.save_pretty(self.args.metadata_file)
コード例 #3
0
 def publish_proto_metadata_init(self):
     ipfs_hash_base58 = utils_ipfs.publish_proto_in_ipfs(
         self._get_ipfs_client(), self.args.protodir)
     metadata = MPEServiceMetadata()
     mpe_address = self.get_mpe_address()
     metadata.set_simple_field("model_ipfs_hash", ipfs_hash_base58)
     metadata.set_simple_field("mpe_address", mpe_address)
     metadata.set_simple_field("display_name", self.args.display_name)
     metadata.set_simple_field("encoding", self.args.encoding)
     metadata.set_simple_field("service_type", self.args.service_type)
     metadata.set_simple_field("payment_expiration_threshold",
                               self.args.payment_expiration_threshold)
     self._metadata_add_group(metadata)
     for endpoint in self.args.endpoints:
         metadata.add_endpoint(self.args.group_name, endpoint)
     if (self.args.fixed_price is not None):
         metadata.set_fixed_price_in_cogs(self.args.fixed_price)
     metadata.save_pretty(self.args.metadata_file)
コード例 #4
0
 def publish_proto_in_ipfs(self):
     """ Publish proto files in ipfs and print hash """
     ipfs_hash_base58 = utils_ipfs.publish_proto_in_ipfs(
         self._get_ipfs_client(), self.args.protodir)
     self._printout(ipfs_hash_base58)