Skip to content

Instantly share code, notes, and snippets.

@vlcinsky
Created October 11, 2017 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vlcinsky/fb33a5d9b0fa67c39a54de7d20d4789f to your computer and use it in GitHub Desktop.
Save vlcinsky/fb33a5d9b0fa67c39a54de7d20d4789f to your computer and use it in GitHub Desktop.
import os
def task_one():
def create_cmd_string(a, b, target):
return "echo a: %s b: %s > %s" % (a, b, target)
with open("list_of_input_filenames.txt") as f:
fnames = [line.strip() for line in f.readlines() if line]
for a in fnames:
for b in fnames:
a_name_tail = os.path.basename(a).split("_")[1]
b_name_tail = os.path.basename(b).split("_")[1]
target = "output/output_%s_%s.out" % (a_name_tail, b_name_tail)
yield {
'name': "%s_%s" % (a_name_tail, b_name_tail),
'actions': [create_cmd_string(a, b, target)],
'file_dep': [a, b],
'targets': [target],
'clean': True
}
import os
def task_1():
def run_task1(a,b,targets):
os.system("programmename -i %s -o %s > %s"%(a,b,targets[0]))
return
LIST=open("list_of_input_filenames.txt",'r')
LIST=LIST.readlines()
for a in LIST:
a=a.rstrip()
for b in LIST:
b=b.rstrip()
if os.path.isfile("output/output_%s_%s.out"%(a.split("/")[-1].split("_")[1],b.split("/")[-1].split("_")[1])) == False:
yield {'name':"task1_%s_%s"%(a.split("/")[-1].split("_")[1],b.split("/")[-1].split("_")[1]),
'actions':[(run_task1,[a,b])],
'file_dep':[a,b],
'targets':["output/output_%s_%s.out"%(a.split("/")[-1].split("_")[1],b.split("/")[-1].split("_")[1])]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment