-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from lidavidm/robust-worker
Explicitly notify user if compiled bot too large
- Loading branch information
Showing
5 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,14 @@ | |
""" | ||
|
||
|
||
UPLOAD_ERROR_MESSAGE = """ | ||
We had some trouble uploading your bot. If you cannot figure out why | ||
this happened, please email us at [email protected]. We can help. | ||
For our reference, here is the trace of the error: | ||
""" | ||
|
||
|
||
def makePath(path): | ||
"""Deletes anything residing at path, creates path, and chmods the directory""" | ||
if os.path.exists(path): | ||
|
@@ -138,15 +146,22 @@ def executeCompileTask(user_id, bot_id, backend): | |
try: | ||
if didCompile: | ||
logging.debug("Bot did compile\n") | ||
archive.zipFolder(temp_dir, os.path.join(temp_dir, str(user_id)+".zip")) | ||
backend.storeBotRemotely(user_id, bot_id, os.path.join(temp_dir, str(user_id)+".zip")) | ||
archive_path = os.path.join(temp_dir, str(user_id)+".zip") | ||
archive.zipFolder(temp_dir, archive_path) | ||
backend.storeBotRemotely(user_id, bot_id, archive_path) | ||
else: | ||
logging.debug("Bot did not compile\n") | ||
logging.debug("Bot errors %s\n" % str(errors)) | ||
|
||
|
||
backend.compileResult(user_id, bot_id, didCompile, language, | ||
errors=(None if didCompile else "\n".join(errors))) | ||
except: | ||
logging.debug("Bot did not upload\n") | ||
traceback.print_exc() | ||
errors.append(UPLOAD_ERROR_MESSAGE + traceback.format_exc()) | ||
backend.compileResult(user_id, bot_id, False, language, | ||
errors="\n".join(errors)) | ||
finally: | ||
# Remove files as bot user (Python will clean up tempdir, but we don't | ||
# necessarily have permissions to clean up files) | ||
|