Beispiel #1
0
def clean(args):
    try:
        Eris.getProxy().status()
        print >> sys.stderr, "eris must be stopped"
    except Pyro4.errors.PyroError:
        try:
            print "storage deleted"
            os.remove(Storage.dbFile())
        except:
            pass
Beispiel #2
0
def count(args):
    try:
        proxy = Eris.getProxy()
        c = proxy.count()
        print "{} packets in storage".format(c)
    except Pyro4.errors.PyroError:
        print >> sys.stderr, "eris not available"
Beispiel #3
0
def status(args=None):
    def printStatus(statusFile, pid=None, cpu=None, mem=None, uptime=None, du=None):
        status = (
            color("WORKING", "green")
            if statusFile and pid
            else color("NOT WORKING", "red")
            if not statusFile and pid is None
            else color("UNKNOWN", "red")
        )
        print "Status: " + status
        if pid:
            print "    PID:     {}".format(pid)
            print "    CPU:     {:.1f}%".format(cpu)
            print "    MEM:     {:.1f}%".format(mem)
            print "    Storage: {} KiB".format(du)
            print "    Up-time: {}".format(str(timedelta(uptime.days, uptime.seconds, 0)))

    statusFile = False
    try:
        with open(config.statusFile, "r") as f:
            statusFile = f.read() == config.STATUS_LINE
    except:
        pass
    try:
        (pid, cpu, mem, uptime, du) = Eris.getProxy().status()
        printStatus(statusFile, pid, cpu, mem, uptime, du)
    except Pyro4.errors.PyroError:
        printStatus(statusFile)
Beispiel #4
0
def get(args):
    try:
        proxy = Eris.getProxy()
        packets = proxy.get(args.since, 0, args.limit)
        print "<packets>"
        for p in packets:
            print '<packet timestamp="{}">\n{}\n</packet>'.format(p[0], "  " + p[1].replace("\n", "\n  "))
        print "</packets>"
    except Pyro4.errors.PyroError:
        print >> sys.stderr, "eris not available"
Beispiel #5
0
def put(args):
    try:
        data = open(args.file, "r").read() if args.file else sys.stdin.read()
        packets = [(args.timestamp, data)]
        proxy = Eris.getProxy()
        proxy.put(packets)
    except IOError as e:
        print >> sys.stderr, e
    except Pyro4.errors.PyroError:
        print >> sys.stderr, "eris not available"
Beispiel #6
0
def start(args):
    Eris().start()
    proxy = Eris.getProxy()
    for _ in range(STATUS_RETRIES):
        try:
            if proxy.ping() == config.PNAME:
                break
        except Pyro4.errors.CommunicationError:
            time.sleep(SLEEP_PERIOD)
    status()
Beispiel #7
0
def stop(args):
    proxy = Eris.getProxy()
    try:
        proxy.stop()
    except Pyro4.errors.CommunicationError:
        pass
    for _ in range(STATUS_RETRIES):
        try:
            if proxy.ping() != config.PNAME:
                break
            time.sleep(SLEEP_PERIOD)
        except Pyro4.errors.CommunicationError:
            break
    status()
    try:
        with open(config.statusFile, "w"):
            pass
    except:
        pass
Beispiel #8
0
def run_bot():
    # Ativamos o i18n em português do módulo `humanize`.
    humanize.activate('pt_BR')

    bot = Eris()
    bot.run(config.token)
Beispiel #9
0
def setup(bot: Eris):
    bot.add_cog(Starboard(bot))
Beispiel #10
0
def setup(bot: Eris):
    bot.add_cog(Misc(bot))
Beispiel #11
0
def setup(bot: Eris):
    bot.add_cog(Economy(bot))
Beispiel #12
0
def setup(bot: Eris):
    bot.add_cog(Config(bot))
Beispiel #13
0
def setup(bot: Eris):
    bot.add_cog(Reminder(bot))
Beispiel #14
0
def setup(bot: Eris):
    bot.add_cog(Status(bot))
Beispiel #15
0
def setup(bot: Eris):
    bot.add_cog(Errors(bot))
Beispiel #16
0
def setup(bot: Eris):
    bot.add_cog(Mod(bot))
Beispiel #17
0
def setup(bot: Eris):
    bot.add_cog(Ranking(bot))
Beispiel #18
0
#!/usr/bin/env python3
import hardware
from eris import Eris
import csv

#TODO: These parameters should rather come from the hardware model in the future
print("Generating Pareto frontier for parameters ...")
for c in ["deduplication-scan", "deduplication-indexed", "tatp"]:
    data = []
    for freq in range(800000, 3600000, 200000):
        for cores in range(1, 5, 1):
            for ht in [0, 1]:
                cpus = (ht + 1) * cores
                #Benchmark names should come from sw model
                params = Eris(cpus).benchmarks(c)
                ipc = hardware.IPC(
                    ht=ht,
                    memory_heaviness=params["memory_heaviness"](),
                    avx_heaviness=params["avx_heaviness"](),
                    compute_heaviness=params["compute_heaviness"](),
                    cache_heaviness=params["cache_heaviness"](),
                    cpus=cpus,
                    freq=freq)
                p_pkg = hardware.P_PKG(
                    memory_heaviness=params["memory_heaviness"](),
                    IPC=ipc,
                    freq=freq,
                    avx_heaviness=params["avx_heaviness"](),
                    compute_heaviness=params["compute_heaviness"](),
                    cpus=cpus)
                tps = (freq * 1000) / (params["ipt"]() / ipc)