jbjorne / TEES

Turku Event Extraction System
147 stars 44 forks source link

UnixConnection.py has a problem in osx. #1

Closed yumyai closed 11 years ago

yumyai commented 11 years ago

I am trying TEES on mac (mountain lion). There is command that not compatible with tools on osx.

In Utils/Connection/UnixConnection.py: line 478. You used

for line in self.run("ps -p " + jobAttr["PID"] + " -o etime, --no-heading"):

A --no-heading option is not available for ps on osx. Changing that line to for line in self.run("ps -p " + jobAttr["PID"] + " -o etime,")[1:]: works well.

I only try with "python classify.py -m GE -i 9668063 -o OUTSTEM" job though.

renaud commented 11 years ago

Thanks Jari for sharing your code.

I can confirm the above issue on OS X. I fixed it like this

for line in self.run("ps -p " + jobAttr["PID"] + " -o etime=\"\" "):

Also, I had to add some memory to BANNER to make it work.

--- a/Tools/BANNER.py
+++ b/Tools/BANNER.py
@@ -248,9 +248,9 @@ def run(input, output=None, elementName="entity", processElement="document", spl
 cwd = os.getcwd()
 os.chdir(bannerPath)
 if oldVersion: # old version
-        args = ["java", "-cp", classPath, "banner.eval.TestModel", config]
+        args = ["java", "-Xms1G", "-Xmx2G", "-cp", classPath, "banner.eval.TestModel", config]
 else:
-        args = ["java", "-cp", classPath, "banner.eval.BANNER", "test", config]
+        args = ["java", "-Xms1G", "-Xmx2G", "-cp", classPath, "banner.eval.BANNER", "test", config]
 print >> sys.stderr, "BANNER command:", " ".join(args)```
jbjorne commented 11 years ago

Thank you for the bug reports!

I've fixed the issue with the OS X ps command using yumyai's suggestion, by removing the --no-heading switch and reading the output lines starting from 1.

As for the java memory issue, I added a "JAVA" parameter to the configuration settings. By default this is just the "java" command, but to define your own java settings, you can override it in ".tees_local_settings.py" (or whatever file you use for local settings). E.g. for the memory error mentioned by renaud, you would add to the local settings file the line:

JAVA = "java -Xms1G -Xmx2G"

The JAVA setting could also be used to point to a non-standard java installation not in the path etc.

Both updates have been pushed to the main TEES repository. Hopefully these fixes will solve the issues mentioned!

renaud commented 11 years ago

Thanks Jari!