Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: infra/services/service_manager/__main__.py

Issue 1165673003: Don't log if the job is already running - otherwise it spams cron. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@moremastermon
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import logging 7 import logging
8 import signal 8 import signal
9 import socket 9 import socket
10 import sys 10 import sys
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 def sigint_handler(_signal, _frame): 68 def sigint_handler(_signal, _frame):
69 watcher.stop() 69 watcher.stop()
70 70
71 try: 71 try:
72 with daemon.flock('service_manager.flock', opts.state_directory): 72 with daemon.flock('service_manager.flock', opts.state_directory):
73 previous_sigint_handler = signal.signal(signal.SIGINT, sigint_handler) 73 previous_sigint_handler = signal.signal(signal.SIGINT, sigint_handler)
74 watcher.run() 74 watcher.run()
75 signal.signal(signal.SIGINT, previous_sigint_handler) 75 signal.signal(signal.SIGINT, previous_sigint_handler)
76 except daemon.LockAlreadyLocked: 76 except daemon.LockAlreadyLocked:
77 logging.error('Another instance of service_manager is already running') 77 # Another instance is already running.
78 return 1 78 return 1
79 else: 79 else:
80 ts_mon.close() 80 ts_mon.close()
81 81
82 return 0 82 return 0
83 83
84 84
85 if __name__ == '__main__': 85 if __name__ == '__main__':
86 sys.exit(main(sys.argv[1:])) 86 sys.exit(main(sys.argv[1:]))
87 87
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698