<commit_before>import os
import json
import time
import boto3

from EOSS.aws.utils import dev_client, prod_client
from EOSS.aws.utils import eval_task_iam_arn


class Task:

    def __init__(self, dev=False):
        if dev:
            self.client = dev_client('ecs')
        else:
            self.client = prod_client('ecs')



    def register_task_definition(self,
                                 group_id,
                                 problem_id,
                                 eval_queue_url,
                                 apollo_url,
                                 apollo_ws_url,
                                 request_mode='CRISP-ATTRIBUTES'
                                 ):
        task_arn = self.does_task_exist(problem_id)
        print('---> TASK DEFINITION VALUE:', task_arn)
        if task_arn is None:
            response = self.client.register_task_definition(
                family='evaluator',
                taskRoleArn=eval_task_iam_arn(),
                networkMode='awsvpc',
                requiresCompatibilities=['FARGATE'],
                cpu='1 vCPU',
                memory='2 GB',
                containerDefinitions=[
                    {
                        "name": "vassar",
                        "image": "apazagab/design-evaluator",
                        "privileged": False,
                        "interactive": True,
                        "logConfiguration": {
                            "logDriver": "awslogs",
                            'options': {
                                'awslogs-region': 'us-east-2',
                                'awslogs-group': 'seakers-evaluation-logs'
                            }
                        },
                        "environment": [
                            {"name": "PROBLEM_ID", "value": str(problem_id)},
                            {"name": "GROUP_ID", "value": str(group_id)},
                            {"name": "REQUEST_MODE", "value": str(request_mode)},
                            {"name": "PRIVATE_QUEUE_NAME", "value": "RANDOM"},
                            {"name": "EVAL_QUEUE_URL", "value": str(eval_queue_url)},
                            {"name": "APOLLO_URL_WS", "value": str(apollo_url)},
                            {"name": "APOLLO_URL", "value": str(apollo_ws_url)}
                        ]
                    }
                ],
                tags=[<commit_msg>enabled task deregistration for testing<commit_after>import os
import json
import time
import boto3

from EOSS.aws.utils import dev_client, prod_client
from EOSS.aws.utils import eval_task_iam_arn


class Task:

    def __init__(self, dev=False):
        if dev:
            self.client = dev_client('ecs')
        else:
            self.client = prod_client('ecs')



    def register_task_definition(self,
                                 group_id,
                                 problem_id,
                                 eval_queue_url,
                                 apollo_url,
                                 apollo_ws_url,
                                 request_mode='CRISP-ATTRIBUTES'
                                 ):
        task_arn = self.does_task_exist(problem_id)
        print('---> TASK DEFINITION VALUE:', task_arn)
        if task_arn is None:
            response = self.client.register_task_definition(
                family='evaluator',
                taskRoleArn=eval_task_iam_arn(),
                networkMode='awsvpc',
                requiresCompatibilities=['FARGATE'],
                cpu='1 vCPU',
                memory='2 GB',
                containerDefinitions=[
                    {
                        "name": "vassar",
                        "image": "apazagab/design-evaluator",
                        "privileged": False,
                        "interactive": True,
                        "logConfiguration": {
                            "logDriver": "awslogs",
                            'options': {
                                'awslogs-region': 'us-east-2',
                                'awslogs-group': 'seakers-evaluation-logs',
                                'awslogs-stream-prefix': 'daphne-eval-logs'
                            }
                        },
                        "environment": [
                            {"name": "PROBLEM_ID", "value": str(problem_id)},
                            {"name": "GROUP_ID", "value": str(group_id)},
                            {"name": "REQUEST_MODE", "value": str(request_mode)},
                            {"name": "PRIVATE_QUEUE_NAME", "value": "RANDOM"},
                            {"name": "EVAL_QUEUE_URL", "value": str(eval_queue_url)},
                            {"name": "APOLLO_URL_WS", "value": str(apollo_url)},
                            {"name": "APOLLO_URL", "value": str(apollo_ws_url)}
                        ]
                    }
                ],
                tags=[
{'fraction_non_alphanumeric': 0.10373360242179616, 'fraction_numerical': 0.0016145307769929364, 'mean_word_length': 1.0607068607068606, 'pattern_counts': {'":': 42, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '571004', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1213, 'n_words': 215}