Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TOOLS] FIX sofa-launcher stdout #592

Merged
merged 1 commit into from
Feb 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions tools/sofa-launcher/integration_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
{"GRAVITYXML": "1 2 5", "GRAVITYPY": [1,2,1], "nbIterations":1000 } ],
filesandtemplates, launcher=SerialLauncher())

for res in results:
matrix = scip.loadmatrix(res["directory")+"/"+"toto.mtx")
plot(matrix)

for res in results:
print("Results: ")
print(" directory: "+res["directory"])
Expand Down
11 changes: 7 additions & 4 deletions tools/sofa-launcher/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def start(self, tasks):
logfile.write(astdout)
logfile.write("========= STDERR-LOG============\n")
logfile.write(astderr)

logfile.close()

results.append({
"directory" : directory,
"scene" : scene,
Expand Down Expand Up @@ -75,7 +76,7 @@ def worker(self):

begin = time.time()
try:
a = Popen(["runSofa", "-g", "-l", "SofaPython", "batch", "-n", str(numiterations), scene], cwd=directory, stdout=PIPE, stderr=PIPE, universal_newlines=True)
a = Popen(["runSofa", "-l", "SofaPython", "-g", "batch", "-n", str(numiterations), scene], cwd=directory, stdout=PIPE, stderr=PIPE, universal_newlines=True)
except:
print("Unable to find runSofa, please add the runSofa location to your PATH and restart sofa-launcher.")
sys.exit(-1)
Expand All @@ -91,7 +92,8 @@ def worker(self):
logfile.write(astdout)
logfile.write("========= STDERR-LOG============\n")
logfile.write(astderr)

logfile.close()

#logfile.write("========== MATCH-LOG ===========\n")
#logfile.write(str(filtering(astdout)))

Expand Down Expand Up @@ -155,8 +157,8 @@ def worker(self, host):
logfile.write(astdout)
logfile.write("========= STDERR-LOG============\n")
logfile.write(astderr)

logfile.write("========== MATCH-LOG ===========\n")
logfile.close()

self.pendingtask.task_done()

Expand Down Expand Up @@ -203,6 +205,7 @@ def startSofa(parameters, filesandtemplates, launcher):
theFile = open(files[i], "w+")
t = Template(template, searchList=param)
theFile.write(str(t))
theFile.close()
i+=1

tasks.append((param["nbIterations"], tempdir, param["FILE0"], tempdir+"/output.log"))
Expand Down