<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# listed below:
#
# Authors: <NAME> <<EMAIL>>
#          <NAME> <<EMAIL>>
#

import StringIO
import os
import traceback
import glob
import subprocess
import time
import urllib2
import voodoo.killer as killer

class WebLabProcess(object):

    def __init__(self, launch_file, host, base_location = '', verbose = False):
        super(WebLabProcess, self).__init__()

        self.out = 'Not started'
        self.err = 'Not started'

        if os.sep != '/' and '/' in launch_file and os.sep in launch_file:
            raise Exception("Both %s and / found in launch_file (%s), only one expected" % (os.sep, launch_file))

        self.host        = host
        self.base_location = base_location
        self.verbose       = verbose

        normalized_launch_file = launch_file.replace('/', os.sep) 
        
        self.launch_file = os.path.basename(normalized_launch_file)
        self.launch_path = os.path.abspath(os.path.dirname(normalized_launch_file))

        if not os.path.exists(self.launch_path):
            raise Exception("Expected launch path %s not found" % self.launch_path)

        debugging_file = os.path.join(self.launch_path, 'debugging.py')

        if not os.path.exists(debugging_file):
            raise Exception("Expected debugging file %s not found" % debugging_file)

        variables = {}
        execfile(debugging_file, variables, variables)
        self.ports = variables['PORTS']

        # 
        # After running the bot several times, the amount of files stored and logs
        # increase a lot. We remove them in the beginning. We should do the same
        # with the database.
        # 
        files_stored_dir = os.path.join(self.launch_path, 'files_stored')
        if os.path.exists(files_stored_dir):
            for file_stored in glob.glob('%s/*' % files_stored_dir):
                os.remove(file_stored)

        logs_dir = os.path.join(self.launch_path, 'logs')
        if os.path.exists(logs_dir):
            for log_file in glob.glob('%s/*txt*' % logs_dir):
                os.remove(log_file)


    def _has_started(self):
        running  = []<commit_msg>Use the BASE_URL from the debugging.py in wl_process<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# listed below:
#
# Authors: <NAME> <<EMAIL>>
#          <NAME> <<EMAIL>>
#

import StringIO
import os
import traceback
import glob
import subprocess
import time
import urllib2
import voodoo.killer as killer

class WebLabProcess(object):

    def __init__(self, launch_file, host, base_location = '', verbose = False):
        super(WebLabProcess, self).__init__()

        self.out = 'Not started'
        self.err = 'Not started'

        if os.sep != '/' and '/' in launch_file and os.sep in launch_file:
            raise Exception("Both %s and / found in launch_file (%s), only one expected" % (os.sep, launch_file))

        self.host        = host
        self.verbose       = verbose

        normalized_launch_file = launch_file.replace('/', os.sep) 
        
        self.launch_file = os.path.basename(normalized_launch_file)
        self.launch_path = os.path.abspath(os.path.dirname(normalized_launch_file))

        if not os.path.exists(self.launch_path):
            raise Exception("Expected launch path %s not found" % self.launch_path)

        debugging_file = os.path.join(self.launch_path, 'debugging.py')

        if not os.path.exists(debugging_file):
            raise Exception("Expected debugging file %s not found" % debugging_file)

        variables = {}
        execfile(debugging_file, variables, variables)
        self.ports = variables['PORTS']
        self.base_location = variables.get('BASE_URL', base_location)

        # 
        # After running the bot several times, the amount of files stored and logs
        # increase a lot. We remove them in the beginning. We should do the same
        # with the database.
        # 
        files_stored_dir = os.path.join(self.launch_path, 'files_stored')
        if os.path.exists(files_stored_dir):
            for file_stored in glob.glob('%s/*' % files_stored_dir):
                os.remove(file_stored)

        logs_dir = os.path.join(self.launch_path, 'logs')
        if os.path.exists(logs_dir):
            for log_file in glob.glob('%s/*txt*' % logs_dir):
                os.remove(log_file)


    def _has_started(self):
        running  = []
{'fraction_non_alphanumeric': 0.10321931589537223, 'fraction_numerical': 0.002414486921529175, 'mean_word_length': 2.6524614254224836, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2637920', 'n_tokens_mistral': 1532, 'n_tokens_neox': 1448, 'n_words': 418}