<commit_before>
from datetime import datetime
import json
import time
import re
import os
import threading
from apscheduler.schedulers.background import BackgroundScheduler


class SchedulerEdge(object):
    #instacia do objeto e inicia o escalonador
    def __init__(self):

        def run_thread():
            while(True):
                time.sleep(1)

        self.scheduler = BackgroundScheduler() # atribui um agendador background
        self.scheduler.start() # inicia o agendador
        self.th = threading.Thread(target= run_thread) # thread executa outtro fluxo para o agendador rodar
        self.th.start()

    def add_job (self, a): # cria uma nova tarefa no escalonador
    #  analisar o modo (interval,date,cron) para executar de forma correta
        jsonObject = json.loads(a)
        print(jsonObject['modo'],jsonObject['info']['day'])
        self.scheduler.add_job(self.tick, jsonObject['modo'], second = jsonObject['info']['second'], minute = jsonObject['info']['minute'],
        hour = jsonObject['info']['hour'], day = jsonObject['info']['day'], month = jsonObject['info']['month'], year = jsonObject['info']['year'],id = a, args = [a])

    def remove_job(self, a):
        self.scheduler.remove_job(a)

    def tick(self,response):
        print(response)<commit_msg>choose mode of scheduler control<commit_after>
from datetime import datetime
import json
import time
import re
import os
import threading
from apscheduler.schedulers.background import BackgroundScheduler


class SchedulerEdge(object):
    #instacia do objeto e inicia o escalonador
    def __init__(self):

        def run_thread():
            while(True):
                time.sleep(1)

        self.scheduler = BackgroundScheduler() # atribui um agendador background
        self.scheduler.start() # inicia o agendador
        self.th = threading.Thread(target= run_thread) # thread executa outtro fluxo para o agendador rodar
        self.th.start()

    def add_job (self, a): # cria uma nova tarefa no escalonador
    #  analisar o modo (interval,date,cron) para executar de forma correta
        jsonObject = json.loads(a)

        if(jsonObject['modo']=='cron'):
            self.scheduler.add_job(self.tick, jsonObject['modo'], second = jsonObject['info']['second'], minute = jsonObject['info']['minute'],
            hour = jsonObject['info']['hour'], day = jsonObject['info']['day'], month = jsonObject['info']['month'], year = jsonObject['info']['year'],id = a, args = [a])
        elif(jsonObject['modo']=='interval'):
            print("ok1")
        elif(jsonObject['modo']=='date'):
            print("ok2")

    def remove_job(self, a):
        self.scheduler.remove_job(a)

    def tick(self,response):
        print(response)
{'fraction_non_alphanumeric': 0.12691466083150985, 'fraction_numerical': 0.0014587892049598833, 'mean_word_length': 3.424193548387097, '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': '3517757', 'n_tokens_mistral': 812, 'n_tokens_neox': 793, 'n_words': 211}