[www] Don't leak a compiler environment in describe.
@@ -212,7 +212,7 @@ def compute_state(env: CompilerEnv, actions: List[int]) -> StateToVisualize:
@app.route("/api/v3/describe")
def describe():
- env = compiler_gym.make("llvm-v0")
+ with compiler_gym.make("llvm-v0") as env:
env.reset()
return jsonify(
{
@@ -223,7 +223,10 @@ def describe():
"benchmarks": {
dataset.name: list(
islice(
- (x[len(dataset.name) + 1 :] for x in dataset.benchmark_uris()),
+ (
+ x[len(dataset.name) + 1 :]
+ for x in dataset.benchmark_uris()
+ ),
10,
)
)
