Create schema for all client stubs

Moved from GitHub pydgraph/113

Posted by sausageRoll:

If I create client with several alphas:
self.client = pydgraph.DgraphClient(self.client_stub1, self.client_stub2, self.client_stub3)

Should I have possibility to execute schema creation for all nodes instead of one?

op = pydgraph.Operation(schema=self.query.get_query_by_name('schema.txt'))
self.client1.alter(op)

....

return self.any_client().alter(operation, timeout=timeout,
                                           metadata=new_metadata,
                                           credentials=credentials)

Instead we’re getting one random client and only one alpha will have appropriate schema, then requests to other alphas will fail.

martinmr commented :

I don’t understand your question. If you send a schema to any alpha, it will be propagated to all of the nodes in the cluster.

sausageRoll commented :

But we don’t know when it’ll be propagated, right?

martinmr commented :

It happens right away.

sausageRoll commented :

Maybe I miss-configured something, but I’m getting error for one instance in a cluster while the second one is able to serve query

Schema not defined for predicate: temp. while running: name:"eq" args:"111088918"

martinmr commented :

It seems more of an issue with the cluster setup. What’s the output of running curl <your zero hostname>:<your zero port>/state? By default it would be something like curl localhost:6080/state.

sausageRoll commented :

I see, only one server, so setup issue
Sorry for bothering and thank you for help!