import sys import os from pathlib import Path from os.path import dirname as opd from os.path import realpath as opr sys.path.insert(0, opd(opd(opr(__file__)))) # place /path/to/hoad/ in sys.path import csv import pickle import numpy as np from imitator_agents.data_creation_wrappers.create_agent_data import DataCreator import argparse parser = argparse.ArgumentParser() parser.add_argument('--num_games', '--n', type=int, default=25000, help='The number of games to run per agent-agent combo.') parser.add_argument( '--agent', '--a', type=str, default='iggi', help='Imitator agent for which to create data. Must have model' 'present in ./saved_models/<agent>.save/best.h5') parser.add_argument('--batch_num', '--b', type=int, required=True, help='The subdirectory where the games will be saved.') args = parser.parse_args()
import sys from os.path import dirname as opd from os.path import realpath as opr sys.path.insert(0, opd(opd(opd( opr(__file__))))) # place /path/to/hoad/ in sys.path import os import pickle import random import numpy as np import argparse from utils import binary_list_to_int as b2int import imitator_wrapper import naive_mlp_wrapper import maml_agent_wrapper from hanabi_env import rl_env parser = argparse.ArgumentParser() parser.add_argument('--imitators_path', '--i', type=str, default='./imitator_models', help='') parser.add_argument('--maml_agents_path', '--m', type=str, default='./maml_models', help='') parser.add_argument('--naive_agents_path', '--n', type=str,
import sys from os.path import dirname as opd, realpath as opr import os basedir = opd(opd(opr(__file__))) sys.path.append(os.path.join(basedir, "src")) from sharkradar.Config.Config import Config def test_001_get_dbpath_without_set(): """ Test blank DB Path """ assert Config.getDbPath() == "" def test_002_get_dbpath_with_set(): """ Test blank DB Path """ Config.setDbPath("ABC") assert Config.getDbPath() == "ABC/sharkradar_service.db" def test_002_get_algo_without_set(): """ Test blank Algo """ assert Config.getAlgorithm() == "" def test_002_get_algo_with_set(): """ Test blank Algo """ Config.setAlgorithm("ABC") assert Config.getAlgorithm() == "ABC"
""" API endpoints definition related functions for the project """ import sys from os.path import dirname as opd, realpath as opr import os import time import json from flask import Flask, request, render_template basedir = opd(opd(opd(opr(__file__)))) sys.path.append(basedir) from sharkradar.Util import sharkradarDbutils from sharkradar.Service.Health import Health from sharkradar.Service.Discovery import Discovery from sharkradar.Service.MonitorRealTime import MonitorRealTime sharkradarDbutils.createTableIfNotExists() STATIC_DIR = os.path.join(opd(opd(opr(__file__))), 'NonPy_UI_Build') app = Flask(__name__, static_folder=os.path.join(STATIC_DIR, 'build/static'), template_folder=os.path.join(STATIC_DIR, 'build')) @app.route("/health", methods=['PUT']) def health(): """ API Endpoint to send health report of micro-services to Service R/D @method: PUT @params: A json body containing the following key-value pairs about a micro-service.