Пример #1
0
def PublishTo(fromentorno="DEV", toentorno="DEV"):
    id = 0
    if not request.form.get('id') is None:
        id = str(request.form['id'])

    view = ErroresView(Environments.GetEnvironment(fromentorno).MongoServer)
    message = view.GetMessage(id)
    Environments.GetEnvironment(toentorno).Publish(message)
    return jsonify({"Id": id})
Пример #2
0
def BusInfo():
    currentEnvironment = request.cookies.get('environment')
    if currentEnvironment is None:
        currentEnvironment = "DEV"
    envs = list()
    for e in Environments.GetEnvironments():
        envs.append(e.Name)

    return render_template(
        "bus.html",
        envs=envs,
        environment=currentEnvironment,
        service=Environments.GetEnvironment(currentEnvironment).GetBusName())
Пример #3
0
def Errores():
    envs = list()
    for e in Environments.GetEnvironments():
        envs.append(e.Name)
    currentEnvironment = request.cookies.get('environment')
    if currentEnvironment is None:
        currentEnvironment = "DEV"
    return render_template("errores.html",
                           envs=envs,
                           environment=currentEnvironment)
Пример #4
0
 def __init__(self, base_url, username, password, verify_ssl=True):
     api_args = {
         "base_url": base_url,
         "username": username,
         "password": password,
         "verify_ssl": verify_ssl
     }
     self.queues = Queues(**api_args)
     self.users = Users(**api_args)
     self.organization_units = OrganizationUnits(**api_args)
     self.assets = Assets(**api_args)
     self.robots = Robots(**api_args)
     self.environments = Environments(**api_args)
Пример #5
0
def GetErrores(entorno="DEV"):
    page = 1
    rows = 20
    if not request.form.get('page') is None:
        page = int(request.form['page'])
    if not request.form.get('rows') is None:
        rows = int(request.form['rows'])
    view = ErroresView(Environments.GetEnvironment(entorno).MongoServer)

    filter = dict()
    if not request.form.get('Service') is None:
        filter['Service'] = request.form['Service']

    if not request.form.get('HandlerType') is None:
        filter['HandlerType'] = request.form['HandlerType']

    return jsonify(view.GetErrors(page, rows, filter))
Пример #6
0
class Robots(BaseAPI):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.Robot = Robot
        self.regex = re.compile(r"(?<!^)([A-Z])")
        self._environments = Environments(**kwargs)

    def get_robots(self, organization_unit):
        url = f"{self.base_url}/odata/Robots"
        headers = {
            "Authorization": self.auth_token,
            "X-UIPATH-OrganizationUnitId": str(organization_unit.id)
        }
        r = requests.get(url, headers=headers, verify=self.verify_ssl)
        if not r.ok:
            if r.status_code == 401:
                self.Authenticate()
                return self.get_robots(organization_unit)
            else:
                r.raise_for_status()
        return [
            self.json_to_robot(x, organization_unit) for x in r.json()["value"]
        ]

    def json_to_robot(self, data, organization_unit):
        kwargs = {}
        keys = list(data)
        for key in keys:
            new_key = self.regex.sub(r"_\1", key).lower()
            kwargs[new_key] = data.pop(key)
        kwargs["robot_type"] = kwargs.pop("type")
        kwargs["robot_id"] = kwargs.pop("id")
        kwargs["robot_environments"] = [
            environment for environment in self._environments.get_environments(
                organization_unit)
            if kwargs["robot_environments"] == environment.name
        ]
        return self.Robot(**kwargs)
Пример #7
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.Robot = Robot
     self.regex = re.compile(r"(?<!^)([A-Z])")
     self._environments = Environments(**kwargs)
Пример #8
0
def GetError(entorno="DEV"):
    view = ErroresView(Environments.GetEnvironment(entorno).MongoServer)
    id = 0
    if not request.form.get('id') is None:
        id = str(request.form['id'])
    return jsonify(view.GetError(id))
Пример #9
0
def HangoutServices(entorno="DEV"):
    view = ServiceInfoView(Environments.GetEnvironment(entorno).MongoServer)
    services = view.GetServicesNotResponding(90, 10)
    return jsonify({"Services": services})
Пример #10
0
def LoadQueueTop(entorno="DEV"):
    view = ServiceInfoView(Environments.GetEnvironment(entorno).MongoServer)
    services = view.LoadQueueTop(10)
    return jsonify({"Services": services})
Пример #11
0
def TotalBandWidthServiceData(entorno="DEV", id="Bus"):
    view = StatisticsView(Environments.GetEnvironment(entorno).MongoServer)
    services = view.GetTotalBandWidth(id, 7200)
    return jsonify({services})
Пример #12
0
def LatencyServiceData(entorno="DEV", id="Bus"):
    view = StatisticsView(Environments.GetEnvironment(entorno).MongoServer)
    services = view.GetLatency(id, 7200)
    return jsonify({"Data": services})
Пример #13
0
def LatencyPeakTop(entorno="DEV"):
    view = ServiceInfoView(Environments.GetEnvironment(entorno).MongoServer)
    services = view.LantecyPeakTop(10)
    return jsonify({"Services": services})
Пример #14
0
def MemoryTop(entorno="DEV"):
    view = ServiceInfoView(Environments.GetEnvironment(entorno).MongoServer)
    services = view.MemoryTop(5)
    return jsonify({"Services": services})
Пример #15
0
from pyrosim import pyrosim
from Robot import Robot
from Population import Population
from Individual import Individual
from Environments import Environments
import matplotlib.pyplot as plt
import random
import copy
import constants as c
import pickle
envs = Environments()
parents = Population(c.pop_size)
parents.initialize()
parents.evaluate(envs.e, pb=True)
print("0 ", end='')
parents.print_str()
for i in range(1, c.num_gens + 1):
    children = Population(c.pop_size)
    children.fill_from(parents)
    children.evaluate(envs.e, True)
    print(str(i), end=' ')
    children.print_str()
    parents = children
    f = open('data/robot.p', 'wb')
    pickle.dump(parents, f)
parents.evaluate_one(envs.e, True)

Пример #16
0
from Individual import Individual
from Population import Population
from Environments import Environments
import pickle
import constants as c

f = open('data/robot.p', 'rb')
parents = pickle.load(f)
f.close()

envs = Environments()

parents.evaluate(envs.e, True)

for i in range(1, c.num_conts + 1):
    children = Population(parents.pop_size)
    children.fill_from(parents)
    children.evaluate(envs.e, True)
    print(str(i), end=' ')
    children.print_str()

    if children.p[0].fitness > parents.p[0].fitness:
        f = open('data/robot.p', 'wb')
        pickle.dump(children, f)

    parents = children
Пример #17
0
def LatencyServiceData(entorno="DEV", id="Bus"):
    view = StatisticsView(Environments.GetEnvironment(entorno).MongoServer)
    services = view.GetLatency(id, 7200)
    return jsonify({"Data": services})


@app.route('/bandwidthservice/<entorno>/<id>', methods=['GET', 'POST'])
def BandWidthServiceData(entorno="DEV", id="Bus"):
    view = StatisticsView(Environments.GetEnvironment(entorno).MongoServer)
    services = view.GetBandWidth(id, 7200)
    return jsonify({"Data": services})


@app.route('/totalbandwidthservice/<entorno>/<id>', methods=['GET', 'POST'])
def TotalBandWidthServiceData(entorno="DEV", id="Bus"):
    view = StatisticsView(Environments.GetEnvironment(entorno).MongoServer)
    services = view.GetTotalBandWidth(id, 7200)
    return jsonify({services})


@app.route('/loadqueuetop/<entorno>/', methods=['GET', 'POST'])
def LoadQueueTop(entorno="DEV"):
    view = ServiceInfoView(Environments.GetEnvironment(entorno).MongoServer)
    services = view.LoadQueueTop(10)
    return jsonify({"Services": services})


if __name__ == '__main__':
    Environments.Create("environments.cfg")
    app.run(port=18045)