-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vishal Gowda
committed
Mar 7, 2017
1 parent
638bb83
commit e5ae0c2
Showing
12 changed files
with
338 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.pyc | ||
*.pyc | ||
var/* |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import os | ||
|
||
ROOT_DIR = os.path.dirname(__file__) | ||
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
VAR_DIR = os.path.join(ROOT_DIR, 'var') | ||
CONFIG_PATH = os.path.join(ROOT_DIR, 'droid_config.json') | ||
|
||
ZK_HOST = "localhost" | ||
ZK_PORT = "2181" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import os | ||
|
||
from hedroid.logger import logger | ||
from hedroid.common_settings import VAR_DIR | ||
|
||
|
||
class Executor(object): | ||
def __init__(self, id): | ||
self.id = id | ||
self._proc = None | ||
|
||
self.stdout_fd = None | ||
|
||
def _start(self): | ||
raise NotImplementedError() | ||
|
||
def start(self): | ||
logger.debug('Starting {}'.format(self.__class__.__name__)) | ||
self.stdout_fd = open( | ||
os.path.join( | ||
VAR_DIR, "{}-{}".format( | ||
self.__class__.__name__, self.id)), 'w') | ||
self._proc = self._start() | ||
|
||
def stop(self): | ||
logger.debug('Stopping {}'.format(self.__class__.__name__)) | ||
try: | ||
self._proc.terminate() | ||
except: | ||
pass | ||
try: | ||
self._proc.kill() | ||
except: | ||
pass | ||
# Really wait for child process to terminate | ||
self._proc.wait() | ||
# Prevents zombie processes | ||
del self._proc | ||
self._proc = None | ||
# Close file descriptor | ||
self.stdout_fd.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.