Skip to content

Commit 35ceffc

Browse files
authored
Merge pull request alexmojaki#11 from alexmojaki/environ
Clear worker environment
2 parents 59ef0f0 + 05f8f16 commit 35ceffc

File tree

3 files changed

+183
-6
lines changed

3 files changed

+183
-6
lines changed

app.json

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
},
77
"addons": [
88
"cloudamqp",
9-
"sentry",
109
"heroku-postgresql"
1110
],
1211
"formation": {

backend/main/test_transcript.json

+181-5
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,71 @@
7878
"result": [
7979
{
8080
"color": "red",
81-
"text": " File \"<console>\", line 1\n 3 x 4\n ^\nSyntaxError: invalid syntax\n"
81+
"text": "Traceback (most recent call last):\n"
82+
},
83+
{
84+
"color": "red",
85+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/code.py\", line 63, in runsource\n"
86+
},
87+
{
88+
"color": "red",
89+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/codeop.py\", line 168, in __call__\n"
90+
},
91+
{
92+
"color": "red",
93+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/codeop.py\", line 99, in _maybe_compile\n"
94+
},
95+
{
96+
"color": "red",
97+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/codeop.py\", line 87, in _maybe_compile\n"
98+
},
99+
{
100+
"color": "red",
101+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/codeop.py\", line 133, in __call__\n"
102+
},
103+
{
104+
"color": "red",
105+
"text": " File \"<console>\", line 1\n"
106+
},
107+
{
108+
"color": "red",
109+
"text": " "
110+
},
111+
{
112+
"color": "red",
113+
"text": "3 x 4\n"
114+
},
115+
{
116+
"color": "red",
117+
"text": " "
118+
},
119+
{
120+
"color": "red",
121+
"text": " "
122+
},
123+
{
124+
"color": "red",
125+
"text": " "
126+
},
127+
{
128+
"color": "red",
129+
"text": "^\n"
130+
},
131+
{
132+
"color": "red",
133+
"text": "SyntaxError"
134+
},
135+
{
136+
"color": "red",
137+
"text": ": "
138+
},
139+
{
140+
"color": "red",
141+
"text": "invalid syntax"
142+
},
143+
{
144+
"color": "red",
145+
"text": "\n"
82146
},
83147
{
84148
"color": "white",
@@ -378,7 +442,31 @@
378442
"result": [
379443
{
380444
"color": "red",
381-
"text": "Traceback (most recent call last):\n File \"<console>\", line 1, in <module>\nNameError: name 'sunshine' is not defined\n"
445+
"text": "Traceback (most recent call last):\n"
446+
},
447+
{
448+
"color": "red",
449+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/code.py\", line 90, in runcode\n"
450+
},
451+
{
452+
"color": "red",
453+
"text": " File \"<console>\", line 1, in <module>\n"
454+
},
455+
{
456+
"color": "red",
457+
"text": "NameError"
458+
},
459+
{
460+
"color": "red",
461+
"text": ": "
462+
},
463+
{
464+
"color": "red",
465+
"text": "name 'sunshine' is not defined"
466+
},
467+
{
468+
"color": "red",
469+
"text": "\n"
382470
},
383471
{
384472
"color": "white",
@@ -3195,7 +3283,47 @@
31953283
"result": [
31963284
{
31973285
"color": "red",
3198-
"text": " File \"<console>\", line 1\nSyntaxError: expression cannot contain assignment, perhaps you meant \"==\"?\n"
3286+
"text": "Traceback (most recent call last):\n"
3287+
},
3288+
{
3289+
"color": "red",
3290+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/code.py\", line 63, in runsource\n"
3291+
},
3292+
{
3293+
"color": "red",
3294+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/codeop.py\", line 168, in __call__\n"
3295+
},
3296+
{
3297+
"color": "red",
3298+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/codeop.py\", line 99, in _maybe_compile\n"
3299+
},
3300+
{
3301+
"color": "red",
3302+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/codeop.py\", line 87, in _maybe_compile\n"
3303+
},
3304+
{
3305+
"color": "red",
3306+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/codeop.py\", line 133, in __call__\n"
3307+
},
3308+
{
3309+
"color": "red",
3310+
"text": " File \"<console>\", line 1\n"
3311+
},
3312+
{
3313+
"color": "red",
3314+
"text": "SyntaxError"
3315+
},
3316+
{
3317+
"color": "red",
3318+
"text": ": "
3319+
},
3320+
{
3321+
"color": "red",
3322+
"text": "expression cannot contain assignment, perhaps you meant \"==\"?"
3323+
},
3324+
{
3325+
"color": "red",
3326+
"text": "\n"
31993327
},
32003328
{
32013329
"color": "white",
@@ -4072,7 +4200,31 @@
40724200
"result": [
40734201
{
40744202
"color": "red",
4075-
"text": "Traceback (most recent call last):\n File \"<console>\", line 1, in <module>\nIndexError: list index out of range\n"
4203+
"text": "Traceback (most recent call last):\n"
4204+
},
4205+
{
4206+
"color": "red",
4207+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/code.py\", line 90, in runcode\n"
4208+
},
4209+
{
4210+
"color": "red",
4211+
"text": " File \"<console>\", line 1, in <module>\n"
4212+
},
4213+
{
4214+
"color": "red",
4215+
"text": "IndexError"
4216+
},
4217+
{
4218+
"color": "red",
4219+
"text": ": "
4220+
},
4221+
{
4222+
"color": "red",
4223+
"text": "list index out of range"
4224+
},
4225+
{
4226+
"color": "red",
4227+
"text": "\n"
40764228
},
40774229
{
40784230
"color": "white",
@@ -4981,7 +5133,31 @@
49815133
"result": [
49825134
{
49835135
"color": "red",
4984-
"text": "Traceback (most recent call last):\n File \"<console>\", line 1, in <module>\nNameError: name 'nums' is not defined\n"
5136+
"text": "Traceback (most recent call last):\n"
5137+
},
5138+
{
5139+
"color": "red",
5140+
"text": " File \"/Users/alexhall/.pyenv/versions/3.8.0/lib/python3.8/code.py\", line 90, in runcode\n"
5141+
},
5142+
{
5143+
"color": "red",
5144+
"text": " File \"<console>\", line 1, in <module>\n"
5145+
},
5146+
{
5147+
"color": "red",
5148+
"text": "NameError"
5149+
},
5150+
{
5151+
"color": "red",
5152+
"text": ": "
5153+
},
5154+
{
5155+
"color": "red",
5156+
"text": "name 'nums' is not defined"
5157+
},
5158+
{
5159+
"color": "red",
5160+
"text": "\n"
49855161
},
49865162
{
49875163
"color": "white",

backend/main/workers/worker.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import linecache
22
import logging
3+
import os
34
import sys
45
from code import InteractiveConsole
56
from threading import Thread
@@ -61,6 +62,7 @@ def worker_loop_in_thread(*args):
6162

6263

6364
def worker_loop(task_queue, input_queue, result_queue):
65+
os.environ.clear()
6466
# Open the queue files before setting the file limit
6567
result_queue.put(None)
6668
input_queue.empty()

0 commit comments

Comments
 (0)