Skip to content

Commit

Permalink
fix(dev): start/stop deck (#1522)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Wiseblatt committed Mar 30, 2017
1 parent 52ab823 commit e7ee8b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
9 changes: 6 additions & 3 deletions dev/dev_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,19 @@ def tail_error_logs(self):
tail_jobs = []
for subsystem in self.get_all_subsystem_names():
path = os.path.join(log_dir, subsystem + '.err')
open(path, 'w').close()
if not os.path.exists(path):
open(path, 'w').close()
tail_jobs.append(self.start_tail(path))

return tail_jobs

def get_deck_pid(self):
"""Return the process id for deck, or None."""
program='node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js'
program='deck/node_modules/.bin/webpack-dev-server'
stdout, stderr = subprocess.Popen(
'ps -fwwwC node', stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=True, close_fds=True).communicate()
match = re.search('(?m)^[^ ]+ +([0-9]+) .* {program}'.format(
match = re.search('(?m)^[^ ]+ +([0-9]+) .*/{program}'.format(
program=program), stdout)
return int(match.group(1)) if match else None

Expand All @@ -219,6 +220,8 @@ def stop_deck(self):
if pid:
print 'Terminating deck in pid={pid}'.format(pid=pid)
os.kill(pid, signal.SIGTERM)
else:
print 'deck was not running'

def start_all(self, options):
"""Starts all the components then logs stderr to the console forever.
Expand Down
10 changes: 1 addition & 9 deletions dev/refresh_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,7 @@ def write_deck_run_script(self, repository):
cd "$d"
LOG_DIR=${{LOG_DIR:-../logs}}
if [[ node_modules -ot .git ]]; then
# Update npm, otherwise assume nothing changed and we're good.
npm install >& "$LOG_DIR/deck.log"
else
echo "deck npm node_modules looks up to date already."
fi
# Append to the log file we just started.
bash -c "(npm start >> '$LOG_DIR/{name}.log') 2>&1\
bash -c "(./start.sh >> '$LOG_DIR/{name}.log') 2>&1\
| tee -a '$LOG_DIR/{name}.log' >& '$LOG_DIR/{name}.err' &"
""".format(name=name))
os.chmod(path, 0777)
Expand Down

0 comments on commit e7ee8b5

Please sign in to comment.