openedx-unsupported / ease

EASE (Enhanced AI Scoring Engine) is a library that allows for machine learning based classification of textual content. This is useful for tasks such as scoring student essays.
GNU Affero General Public License v3.0
216 stars 96 forks source link

Will/tempdir fix #47

Closed wedaly closed 10 years ago

wedaly commented 10 years ago

When performing spell-check, ease would create a temporary file in the current working directory with the input string.

This caused two problems:

1) In the edx sandbox, the caller did not necessarily have permissions to the current working directory. This would cause grading to fail when opening the temporary file.

2) If multiple processes performed spell-check from the same working directory, they could both write to the same tempfile, corrupting the data.

This PR fixes the issue by using the Python tempfile library to create the tempfile. On Linux, this will create the tempfile in /tmp and assign it a unique name, which resolves both the above issues.

@feanil Can I safely assume that /tmp is world-writeable in stage/production? @nedbat Please review

feanil commented 10 years ago

@wedaly Yes it is safe to assume that /tmp is world-writeable in stage and prod.

wedaly commented 10 years ago

@nedbat Done

nedbat commented 10 years ago

I am giving this a reluctant :+1:. It will spell-check without collision from multiple threads and processes. But there are so many better ways to accomplish much of what it does.... :(