def proc_tank_scheduled(redis_msg, **kw): ext = {'test_id': redis_msg.get('id')} logger = get_logger(**ext) try: except TankClientError as e: logger.error('Tank API call failed: {}'.format(e)) raise if tank_msg['status_code'] == 'PREPARING': return try: lunaport_msg = lunaport_c1.test_get(redis_msg['id']) case_struct = lunaport_c1.case_get(lunaport_msg.get('case_id')) except LunaportClientError as e: logger.error('Lunaport client call failed:{}'.format(e)) raise if tank_msg['status_code'] == 'FINISHED' and tank_msg['exit_code'] == 1: # Test was scheduled but excution failed redis.hdel(r_adr['monitor_start'], kw['id']) notify_test('on_start_failed', lunaport_msg, None, case=case_struct, tank_msg=tank_msg) return diff = { 'status': TestStateTr.port_by_tank(tank_msg.get('status_code')), } t_summary = {} if tank_msg.get('lunapark_id'): try: l_test_id=tank_msg['lunapark_id']).json().pop() t_summary.update({'t_tank_id': redis_msg['t_tank_id']}) diff.update({ 'lunapark': t_summary, }) if t_summary.get('fd'): diff.update({ 'started_at': msk_iso_to_utc(t_summary['fd']).isoformat(), })
diff.update({ 'lunapark': t_summary, }) if t_summary.get('fd'): diff.update({ 'started_at': msk_iso_to_utc(t_summary['fd']).isoformat(), }) try: test_struct, test_loc = lunaport_c1.test_patch(redis_msg['id'], diff) except LunaportClientError as e: test_struct = None logger.error('Lunaport client call failed:{}'.format(e)) if not 'Nothing to update' in str(e): raise redis.hdel(r_adr['monitor_start'], kw['id']) t_struct = test_struct or t_summary notify_test('on_start', t_struct, None, case=case_struct), @celery.task def proc_luna_running(**kw): """ Fetch test statuses from Redis, if test finisged notify service via API and call reduce job. """ ext = {'test_id': kw.get('redis_value', {}).get('id')} logger = get_logger(**ext) if not ('t_fqdn' in kw and 't_tank_id' in kw): logger.erro('proc_luna_running call. Malformed params:{}'.format(kw))