-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
I may be missing an option, but would there be a way to limit memory use per-test / question?
In a Gradescope AG, the following code results in the whole ok process (and thus any output parsing working) at a ~6-7s timeout on smallish machine with 768mb of ram. We can use --timeout 5 to get this down so the whole thing isn't killed, but I wonder if we could specify a per-question memory limit (which could conceivably be freed after each test case or question?)
def arange(start, end, step=1):
"""
arange behaves just like np.arange(start, end, step).
You only need to support positive values for step.
>>> arange(1, 3)
[1, 2]
>>> arange(0, 25, 2)
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24]
>>> arange(999, 1231, 34)
[999, 1033, 1067, 1101, 1135, 1169, 1203]
"""
"*** YOUR CODE HERE ***"
full_list = []
new_number = start
while new_number < end:
full_list.append(new_number)
new_number += start ## This is the bug. should be step which fails in 2nd dockets
return full_list This might be possible...
https://docs.python.org/3.12/library/resource.html#resource.setrlimit
https://www.geeksforgeeks.org/python-how-to-put-limits-on-memory-and-cpu-usage/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels