Comments (9)
@leebaok
I have something to say.
The method getnode that I write in etcdlib.py is aimed at getting both key and value(particularly key) that are stored in the etcd. And It has no relationship about docklet. Maybe the method name getnode is confused. But it is just because that the method getkey has been defined in the etcdlib.py, so I simply change the method name to getnode.
So, is there any necessary to move the getnode from etcdlib.py to worker.py?
from docklet.
I recommend you move getnode out from etcdlib.py. In fact, you only called getnode once in worker.py. Therefore, there is no need to encapsulate it as a function, even in worker.py.
from docklet.
I agree with @caodg ^_^
from docklet.
OK, I get it.
from docklet.
We merged your pull request of independent starting of master and worker.
But for init mode of startup, there is a bug. In worker.py, you set key of runnodes/IP to 'waitting' in line 57 and than test key of runnodes/IP in line 78. Of cause, it exists and the mode is always recovery.
I think you can use allnodes/IP to decide the mode. For example, self.key in line 60 is sat to allnodes/IP and etcd.listdir in line 76 is to get content of 'machines/allnodes'.
What do you think ?
Waiting for your new pull request !
from docklet.
@leebaok
Yes, it is a bug. I will fix it tonight.
from docklet.
There is still a bug. If we init master, the worker will crash. The reason is the node var not defined.
logger.error("get key failed. %s" % node)
There is still a logic error here. If master inits, the worker will definitely fail to get the value. Therefore, the worker should try to register again assuming master has initiated itself. I changed the code as following and it seems working. Please check. @SourceZh @leebaok
diff --git a/src/worker.py b/src/worker.py
index 4a43007..acdaf11 100755
--- a/src/worker.py
+++ b/src/worker.py
@@ -170,8 +170,8 @@ class Worker(object):
if value=='ok':
self.etcd.setkey("machines/runnodes/"+self.addr, "ok", ttl = 2)
else:
- logger.error("get key failed. %s" % node)
- sys.exit(1)
+ logger.warning("get key %s failed, trying register" % self.addr)
+ self.etcd.setkey("machines/runnodes/"+self.addr, "work")
if __name__ == '__main__':
from docklet.
init master without stopping workers is much more complex. If we just restart master with init mode but not stopping workers, much data and status will become not consistent.
So, if we want to init our docklet, restarting master as well as restarting workers is necessary.
And I think restarting master in recovery mode without stopping workers is enough for us.
More: there is a way to init master without stopping workers by hand that master calls worker to restart itself.
from docklet.
Agree.
I have fixed the "var not found" bug.
So I will close this issue, and will create a new one in OS Practice milestone, addressing the issue of restarting workers automatically when initialising master.
from docklet.
Related Issues (20)
- replace GRE with VXLAN to avoid critical-node crash
- not using default setting while scaling out a new node HOT 1
- setting default container setting in user config panel or admin panel HOT 1
- Add multiple nodes in one click
- record and display history of all containers HOT 1
- generated_password file not exist after master init HOT 1
- Separate user module from monitor HOT 1
- Image save failed HOT 2
- rename Dashboard to Workspace HOT 1
- add docklet hyperlink in web portal HOT 1
- Cannot modify users' info in /user/list HOT 1
- Add qos rate limiting and port mappings billings
- Threading Synchronization
- Job Management module in batch computing
- Task management module for batch computing
- agent enhancement to support batch computing
- Users' requests are blocked sometimes because of unreleased users' locks HOT 1
- acquire lock without release when exception occur HOT 1
- Refine container job creation HOT 1
- Any chance updating this to use LXD HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docklet.