This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import threading | |
| import time | |
| from functools import wraps | |
| class AsyncReturn (threading.Thread): | |
| def run(self): | |
| # Give us a default value in case we time out our join() call | |
| # later on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| from fabric.api import env, execute, run, task | |
| from functools import wraps | |
| # | |
| # Fabric command wrapper. Essentially, this surrounds any specified command | |
| # call with the execute() function. Adding this function decoration to unit- | |
| # tests allows us to avoid using execute() functions within our tests. | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def send_message(number, message, username, password): | |
| voice = Voice() | |
| voice.login(username, password) | |
| voice.send_sms(number, message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| t0 = time.time() | |
| p = subprocess.Popen([cmdStr], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
| p.wait() | |
| t1 = time.time() | |
| t = t1 - t0 | |
| os.symlink("%s/%s" % (job_dir, imgFile), "%s/%s.tga" % (images_folder, job_name)) | |
| stdout = p.stdout | |
| stderr = p.stderr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_next_job(jobs_folder): | |
| dirList = os.listdir(jobs_folder) | |
| for fname in dirList: | |
| if (os.path.isfile(jobs_folder + '/' + fname)) and ("run" in fname[-3:]): | |
| return fname[:-4] | |
| return "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ducovar = dict() | |
| pid = str(os.getpid()) | |
| def pid_exists(): | |
| return os.path.isfile(ducovar["PID_FILE"]) | |
| def write_pid(): | |
| if len(ducovar["PID_FILE"]) == 0: | |
| print "Error: invalid pid file [%s]" % ducovar["PID_FILE"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Prop file load | |
| # Based off of http://www.linuxtopia.org/online_books/programming_books/python_programming/python_ch34s04.html | |
| def load_prop(filename): | |
| try: | |
| f = file( filename, 'rU' ) | |
| except: | |
| print "Error: no such property file %s" % filename | |
| sys.exit() | |
| d = dict() | |
| for propline in f: |