File tree Expand file tree Collapse file tree 3 files changed +22
-11
lines changed
Expand file tree Collapse file tree 3 files changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,12 @@ def manage_environments_command(self) -> str:
6666 return ""
6767
6868 def output_formats_mapping (self ) -> Dict [str , str ]:
69- return {"ipynb" : "Notebook" , "html" : "HTML" }
69+ return {
70+ "ipynb" : "Notebook" ,
71+ "html" : "HTML" ,
72+ "stdout" : "Output" ,
73+ "stderr" : "Errors" ,
74+ }
7075
7176
7277class StaticEnvironmentManager (EnvironmentManager ):
@@ -90,7 +95,12 @@ def manage_environments_command(self) -> str:
9095 return ""
9196
9297 def output_formats_mapping (self ) -> Dict [str , str ]:
93- return {"ipynb" : "Notebook" , "html" : "HTML" }
98+ return {
99+ "ipynb" : "Notebook" ,
100+ "html" : "HTML" ,
101+ "stdout" : "Output" ,
102+ "stderr" : "Errors" ,
103+ }
94104
95105
96106class EnvironmentRetrievalError (Exception ):
Original file line number Diff line number Diff line change @@ -308,6 +308,10 @@ async def post(self):
308308 # Ensure backend ID is stored with the job
309309 payload ["backend" ] = backend .config .id
310310 scheduler = backend .scheduler
311+
312+ # Set default output_formats for Python backend
313+ if backend .config .id == "jupyter_server_py" and not payload .get ("output_formats" ):
314+ payload ["output_formats" ] = ["stdout" , "stderr" ]
311315 else :
312316 # Fallback to default scheduler (backwards compatibility)
313317 scheduler = self .scheduler
Original file line number Diff line number Diff line change @@ -33,18 +33,15 @@ def execute(self):
3333 env = env ,
3434 )
3535
36- # Capture side effect files (same pattern as DefaultExecutionManager)
37- self .add_side_effects_files (staging_dir )
38-
39- # Write stdout/stderr to staging directory
40- stdout_path = os .path .join (staging_dir , "stdout.log" )
41- stderr_path = os .path .join (staging_dir , "stderr.log" )
42-
43- with fsspec .open (stdout_path , "w" , encoding = "utf-8" ) as f :
36+ # Write stdout/stderr to staging_paths (keys match output_formats)
37+ with fsspec .open (self .staging_paths ["stdout" ], "w" , encoding = "utf-8" ) as f :
4438 f .write (result .stdout )
45- with fsspec .open (stderr_path , "w" , encoding = "utf-8" ) as f :
39+ with fsspec .open (self . staging_paths [ "stderr" ] , "w" , encoding = "utf-8" ) as f :
4640 f .write (result .stderr )
4741
42+ # Capture any additional side effect files AFTER writing stdout/stderr
43+ self .add_side_effects_files (staging_dir )
44+
4845 if result .returncode != 0 :
4946 raise RuntimeError (
5047 f"Script exited with code { result .returncode } \n stderr: { result .stderr [:500 ]} "
You can’t perform that action at this time.
0 commit comments