You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@joshua.apache.org by mj...@apache.org on 2016/10/15 12:31:28 UTC
[2/3] incubator-joshua git commit: bugfix: don't delete temp file
before using
bugfix: don't delete temp file before using
Project: http://git-wip-us.apache.org/repos/asf/incubator-joshua/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-joshua/commit/62563615
Tree: http://git-wip-us.apache.org/repos/asf/incubator-joshua/tree/62563615
Diff: http://git-wip-us.apache.org/repos/asf/incubator-joshua/diff/62563615
Branch: refs/heads/master
Commit: 625636152416e1eca9e21a84859ebed237b9af29
Parents: 3a6e916
Author: Matt Post <po...@cs.jhu.edu>
Authored: Sat Oct 15 08:30:51 2016 -0400
Committer: Matt Post <po...@cs.jhu.edu>
Committed: Sat Oct 15 08:30:51 2016 -0400
----------------------------------------------------------------------
scripts/training/run_thrax.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/62563615/scripts/training/run_thrax.py
----------------------------------------------------------------------
diff --git a/scripts/training/run_thrax.py b/scripts/training/run_thrax.py
index 4457245..1356b05 100755
--- a/scripts/training/run_thrax.py
+++ b/scripts/training/run_thrax.py
@@ -17,7 +17,7 @@
# limitations under the License.
#
"""
-Runs the Z-MERT and PRO tuners.
+Runs Thrax.
"""
from __future__ import print_function
from itertools import izip
@@ -91,7 +91,7 @@ paste(args.source_corpus, args.target_corpus, args.alignment_file, thrax_file)
run('%s/bin/hadoop fs -put %s %s/input-file' % (HADOOP, thrax_file, THRAXDIR))
# Copy the template
-conf_file = tempfile.NamedTemporaryFile(prefix='thrax.conf')
+conf_file = tempfile.NamedTemporaryFile(prefix='thrax.conf', delete=False)
for line in open(args.thrax_config):
if not line.startswith('input-file'):
conf_file.write(line)
@@ -106,5 +106,6 @@ run('%s/bin/hadoop fs -getmerge %s/final/ %s' % (HADOOP, THRAXDIR, args.output_f
# Cleanup
if not args.debug:
+ os.remove(conf_file)
os.remove(thrax_file)
run('%s/bin/hadoop fs -rm -r %s' % (HADOOP, THRAXDIR))