def create_vocab(filename): vocab_path = get_dir_cfg()['vocab_path'] filename = local_dir + vocab_path + filename + ".txt" head, tail = os.path.split(filename) logger.info('get from aws ' + tail) # need to load the file from aws potentially # get_aws_file(vocab_path, tail) return filename
import logging import os import os.path from service.config_service import get_dir_cfg from util.file_utils import get_aws_file logger = logging.getLogger(__name__) local_dir = get_dir_cfg()['local'] TEAMS_FILE = 'team-vocab' def create_vocab(filename, country): vocab_path = get_dir_cfg()['vocab_path'] vocab_path = vocab_path.replace('<key>', country) filename = local_dir + vocab_path + filename + ".txt" head, tail = os.path.split(filename) logger.info('get from aws ' + tail) # need to load the file from aws potentially get_aws_file(vocab_path, tail) return filename
import predict.player_assists_prediction as player_assists_prediction import predict.player_goals_prediction as player_goals_prediction import predict.player_yellow_card_prediction as player_yellow_card_prediction import threading import traceback import train.player_assists_train as player_assists_train import train.player_goals_train as player_goals_train import train.player_yellow_card_train as player_yellow_card_train import util.classifier_utils as classifier_utils from flask import Flask from flask import request from service.config_service import get_dir_cfg app = Flask(__name__) logging.basicConfig(filename=get_dir_cfg()['local'] + 'predictor.log', level=logging.NOTSET) logger = logging.getLogger(__name__) local_dir = get_dir_cfg()['local'] if __name__ == "__main__": app.run(host='0.0.0.0') def set_init(init): if init == 'true': return True else: return False
import boto3 import csv import logging import os import os.path import time from botocore.exceptions import ClientError from service.config_service import get_dir_cfg from service.index_service import process_index, read_index logger = logging.getLogger(__name__) s3_client = boto3.client('s3') aws = get_dir_cfg()['aws'] aws_url = get_dir_cfg()['aws_url'] aws_bucket = get_dir_cfg()['aws_bucket'] local_dir = get_dir_cfg()['local'] def on_finish(tf_models_dir, aws_model_dir): logger.info(' write index ' + tf_models_dir) write_filenames_index(tf_models_dir) try: write_filenames_index(tf_models_dir + '/eval') except Exception as e: logger.info('eval dir not created') logger.info(' put aws files ' + aws_model_dir)
def create_train_path(): train_path = get_dir_cfg()['train_path'] return train_path
import json import logging import predict.match_goals_prediction as match_goals_prediction import predict.match_result_prediction as match_result_prediction import threading import traceback import train.match_goals_train as match_goals_train import train.match_result_train as match_result_train from flask import Flask from flask import request from service.config_service import get_dir_cfg app = Flask(__name__) logging.basicConfig(filename=get_dir_cfg()['local'] + 'predictor.log', level=logging.NOTSET) logger = logging.getLogger(__name__) if __name__ == "__main__": app.run(host='0.0.0.0') # doesnt seem to do anything, should catch interrupted tho. def process(thread): try: thread.start() except Exception as e: logger.error(traceback.format_exc()) # should handle errors at some point def done_response():
def create_train_path(country): train_path = get_dir_cfg()['train_path'] train_path = train_path.replace('<key>', country) return train_path