<commit_before>from os import environ as env

from django.conf import settings
import requests
from datetime import datetime
from django.utils import timezone
from celery.utils.log import get_task_logger

logger = get_task_logger(__name__)

auth = (settings.JENKINS_USER, settings.JENKINS_PASS)


def get_job_status(jobname):
    ret = {
        'active': True,
        'succeeded': False,
        'blocked_build_time': None,
        'status_code': 200
    }
    endpoint = settings.JENKINS_API + 'job/%s/api/json' % jobname
    resp = requests.get(endpoint, auth=auth, verify=True)
    status = resp.json()
    ret['status_code'] = resp.status_code
    ret['job_number'] = status['lastBuild'].get('number', None)
    if status['color'].startswith('blue'):
        ret['active'] = True
        ret['succeeded'] = True<commit_msg>Add check for "green" status for Hudson<commit_after>from os import environ as env

from django.conf import settings
import requests
from datetime import datetime
from django.utils import timezone
from celery.utils.log import get_task_logger

logger = get_task_logger(__name__)

auth = (settings.JENKINS_USER, settings.JENKINS_PASS)


def get_job_status(jobname):
    ret = {
        'active': True,
        'succeeded': False,
        'blocked_build_time': None,
        'status_code': 200
    }
    endpoint = settings.JENKINS_API + 'job/%s/api/json' % jobname
    resp = requests.get(endpoint, auth=auth, verify=True)
    status = resp.json()
    ret['status_code'] = resp.status_code
    ret['job_number'] = status['lastBuild'].get('number', None)
    if status['color'].startswith('blue') or status['color'].startswith('green'): # Jenkins uses "blue" for successful; Hudson uses "green"
        ret['active'] = True
        ret['succeeded'] = True
{'fraction_non_alphanumeric': 0.12184166198764738, 'fraction_numerical': 0.003368893879842785, 'mean_word_length': 3.8555858310626703, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3482798', 'n_tokens_mistral': 565, 'n_tokens_neox': 549, 'n_words': 137}