~psivaa/uci-engine/lander-jenkins-with-proxy

« back to all changes in this revision

Viewing changes to lander/lander/run_worker.py

  • Committer: Evan Dandrea
  • Date: 2014-03-14 10:37:28 UTC
  • mfrom: (387 ubuntu-ci-services-itself)
  • mto: This revision was merged to the branch mainline in revision 389.
  • Revision ID: evan.dandrea@canonical.com-20140314103728-i9wqk4r17gsya24h
Merge with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from ci_utils import jenkins_utils
27
27
from ci_utils import dump_stack
28
28
 
29
 
MAX_RETRIES = 15
30
29
SERVICE_PATH = os.path.join(os.path.dirname(__file__), '../../juju-relations')
31
30
 
32
31
# set up a root logger for everything
120
119
 
121
120
 
122
121
def main(args):
123
 
    retries = MAX_RETRIES
124
122
    logging.info('Starting lander-jenkins worker.')
125
 
    while retries:
 
123
    while True:
126
124
        logging.info('Trying to acquire jenkins config.')
127
125
        jenkins_config = jenkins_utils.get_config()
128
126
        if not jenkins_config:
129
 
            retries -= 1
130
 
            logging.error('Unable to acquire jenkins configuration, '
131
 
                          'will retry {} more times.'.format(retries))
 
127
            logging.error('Unable to acquire jenkins configuration, retrying')
132
128
            time.sleep(args.delay)
133
129
        else:
134
130
            break
135
 
    if not retries:
136
 
        logging.error('Failed to acquire jenkins configuration, '
137
 
                      'no more retries.')
138
 
        return -1
139
131
 
140
 
    retries = MAX_RETRIES
141
 
    while retries:
 
132
    while True:
142
133
        logging.info('Trying to acquire ticket service url.')
143
134
        service_url = get_service_url(args.service_name, args.service_port)
144
135
        if not service_url:
145
 
            retries -= 1
146
 
            logging.error('Unable to acquire ticket service url, '
147
 
                          'will retry {} more times.'.format(retries))
 
136
            logging.error('Unable to acquire ticket service url, retrying')
148
137
            time.sleep(args.delay)
149
138
        else:
150
139
            break
151
 
    if not retries:
152
 
        logging.error('Failed to acquire ticket service url, '
153
 
                      'no more retries.')
154
 
        return -1
155
140
 
156
141
    while True:
157
142
        logging.info('Polling for a new ticket')