Merge lp:~adeuring/charms/precise/charmworld/charm-set-lock-timeout into lp:~juju-jitsu/charms/precise/charmworld/trunk
Proposed by
Abel Deuring
Status: | Merged |
---|---|
Approved by: | Abel Deuring |
Approved revision: | 48 |
Merged at revision: | 57 |
Proposed branch: | lp:~adeuring/charms/precise/charmworld/charm-set-lock-timeout |
Merge into: | lp:~juju-jitsu/charms/precise/charmworld/trunk |
Diff against target: |
28 lines (+12/-0) 1 file modified
scripts/write_config.py (+12/-0) |
To merge this branch: | bzr merge lp:~adeuring/charms/precise/charmworld/charm-set-lock-timeout |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Aaron Bentley (community) | Approve | ||
Review via email: mp+151056@code.launchpad.net |
Commit message
set the lease time for scripts locks from the juju config parameter execute-
Description of the change
Get the lock lease time from the ingest cycle time
The scripts "queue" and "review" acquire locks to avoid concurrent
runs of these scripts on multiple instances.
The lease time for these locks can and should be set from the
"cycle time" of the scripts. Curtis suggested to keep the lock
for twice as long; I added one minute more to avoid possible
spurious errors that might occur due to clock skew between two
servers.
To post a comment you must log in.
Reviewers: mp+151056_ code.launchpad. net,
Message:
Please take a look.
Description:
Get the lock lease time from the ingest cycle time
The scripts "queue" and "review" acquire locks to avoid concurrent
runs of these scripts on multiple instances.
The lease time for these locks can and should be set from the
"cycle time" of the scripts. Curtis suggested to keep the lock
for twice as long; I added one minute more to avoid possible
spurious errors that might occur due to clock skew between two
servers.
https:/ /code.launchpad .net/~adeuring/ charms/ precise/ charmworld/ charm-set- lock-timeout/ +merge/ 151056
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/7422045/
Affected files: write_config. py
A [revision details]
M scripts/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: scripts/ write_config. py write_config. py' write_config. py 2013-02-14 19:10:58 +0000 write_config. py 2013-02-28 16:49:04 +0000
=== modified file 'scripts/
--- scripts/
+++ scripts/
@@ -5,6 +5,7 @@
import subprocess
import sys
+from charmsupport. hookenv import config hookenv import related_units hookenv import relation_ids
from charmsupport.
from charmsupport.
@@ -18,6 +19,13 @@ config( mongo_url, default, override, target): [default, override]) config. set('app: main', 'mongo.url', mongo_url) ingest- every, plus 1 minute slack to address lease_time' , )['execute- ingest- every'] * 2 + 1)
new_ config. write(output)
def write_new_
new_config = read_config(
new_
+ # script_lease_time specifies the time for which the scripts
+ # "queue" and "review" hold their locks. Set to twice the time
+ # interval execute-
+ # a possible clock skew between two instances.
+ new_config.set(
+ 'app:main', 'script_
+ config(
with open(target, 'w') as output: