Ejemplo n.º 1
0
def start_test(module):
    print fi.execute(
        "python %s.tac" % (
            os.path.join(fi.ROOT_DIRECTORY, 'fi', slash),
            dot
        )
    )
Ejemplo n.º 2
0
def doLogs(action):
    if os.path.exists('logs'):
        print "Deleting logs directory..."
        fi.execute('rm -rf logs')

    if action == 'install':
        print "Creating logs directory..."
        fi.execute("mkdir logs")
Ejemplo n.º 3
0
def doLogs(action):
    if os.path.exists('logs'):
        print "Deleting logs directory..."
        fi.execute('rm -rf logs')
        
    if action == 'install':
        print "Creating logs directory..."
        fi.execute("mkdir logs")
Ejemplo n.º 4
0
def start(module):
    fi.execute("twistd -y %s.tac --pidfile=%s.pid --logfile=logs/%s" % (
        os.path.join(fi.ROOT_DIRECTORY, 'fi', slash),
        module,
        module,
    ))

    pid = open(module + ".pid", 'r').read().strip()
    print "%s started with pid %s" % (module, pid)
Ejemplo n.º 5
0
def stop(module):
    pid_file = dot + ".pid"

    if not os.path.exists(pid_file):
        return

    pid = open(pid_file, 'r').read().strip()
    fi.execute("kill " + pid)

    print "%s killed with pid %s" % (dot, pid)
Ejemplo n.º 6
0
def start(module):
    fi.execute(
        "twistd -y %s.tac --pidfile=%s.pid --logfile=logs/%s" % (
            os.path.join(fi.ROOT_DIRECTORY, 'fi', slash),
            module, 
            module,
        )
    )
    
    pid = open(module + ".pid", 'r').read().strip()
    print "%s started with pid %s" % (module, pid)
Ejemplo n.º 7
0
def doDatabase(action):
    if os.path.exists(fi.model.DATABASE_PATH):
        print "Deleting old database..."
        fi.execute("rm -f " + fi.model.DATABASE_PATH)

    # Install
    if action == 'install':
        print "Creating tables..."

        fi.model.createDatabaseTables()
        fi.job.model.setup()
        fi.throttle.model.setup()
Ejemplo n.º 8
0
def doDatabase(action):
    if os.path.exists(fi.model.DATABASE_PATH):
        print "Deleting old database..."
        fi.execute("rm -f " + fi.model.DATABASE_PATH)
    
    # Install    
    if action == 'install':
        print "Creating tables..."
    
        fi.model.createDatabaseTables()
        fi.job.model.setup()
        fi.throttle.model.setup()
Ejemplo n.º 9
0
def stop(module):
    pid_file = dot + ".pid"

    if not os.path.exists(pid_file):
        return
        
    pid = open(pid_file, 'r').read().strip()
    fi.execute("kill " + pid)
    
    print "%s killed with pid %s" % (
        dot,
        pid
    )
Ejemplo n.º 10
0
def doPathload(action):
    print "Setting up pathload..."
    
    BINARIES = (
        "fi/throttle/pathload/pathload_rcv",
        "fi/throttle/pathload/pathload_snd",
    )
    
    for filename in BINARIES:
        if os.path.exists(filename):
            os.remove(filename)
        
    if action == "install":
        fi.execute("cd fi/throttle/pathload/ && ./configure &> /dev/null && make &> /dev/null")
        
        if not all(map(os.path.exists, BINARIES)):
            print "Failed"
            exit(1)
Ejemplo n.º 11
0
def doPathload(action):
    print "Setting up pathload..."

    BINARIES = (
        "fi/throttle/pathload/pathload_rcv",
        "fi/throttle/pathload/pathload_snd",
    )

    for filename in BINARIES:
        if os.path.exists(filename):
            os.remove(filename)

    if action == "install":
        fi.execute(
            "cd fi/throttle/pathload/ && ./configure &> /dev/null && make &> /dev/null"
        )

        if not all(map(os.path.exists, BINARIES)):
            print "Failed"
            exit(1)
Ejemplo n.º 12
0
 def test_execute(self):
     self.assertEqual(
         fi.execute("echo 'eee'").strip(),
         'eee'
     )
Ejemplo n.º 13
0
def start_test(module):
    print fi.execute("python %s.tac" %
                     (os.path.join(fi.ROOT_DIRECTORY, 'fi', slash), dot))