Пример #1
0
def start_test(module):
    print fi.execute(
        "python %s.tac" % (
            os.path.join(fi.ROOT_DIRECTORY, 'fi', slash),
            dot
        )
    )
Пример #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")
Пример #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")
Пример #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)
Пример #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)
Пример #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)
Пример #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()
Пример #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()
Пример #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
    )
Пример #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)
Пример #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)
Пример #12
0
 def test_execute(self):
     self.assertEqual(
         fi.execute("echo 'eee'").strip(),
         'eee'
     )
Пример #13
0
def start_test(module):
    print fi.execute("python %s.tac" %
                     (os.path.join(fi.ROOT_DIRECTORY, 'fi', slash), dot))