@@ -28,6 +28,15 @@ def get_blocks_to_run(worker_id: str, code: str | None = None) -> list[str] | di
2828 Returns:
2929 dict: A dictionary with 'status' as success or error, and 'content' containing either the blocks list or an error message.
3030 """
31+ if API_BASE_URL == 'NOSERVER' :
32+ logging .info ('API_BASE_URL set to NOSERVER, faking server responses' )
33+ tasks = ["rdm" , "flkr" , "bart" , "cab" ]
34+ reformatted_tasks = []
35+ for bn in [0 , 1 ]:
36+ for tt in tasks :
37+ reformatted_tasks .append ({'task_name' :tt , 'block_number' : bn })
38+ logging .info (f'Reformatted task list: { reformatted_tasks } ' )
39+ return {'status' : 'success' , 'content' : reformatted_tasks }
3140 url = f'{ API_BASE_URL } /taskcontrol'
3241 if WORKER_ID_SOURCE == 'EXECUTABLE' :
3342 params = {'worker_id' : worker_id }
@@ -103,6 +112,10 @@ def upload_block(worker_id: str, block_name: str, data_directory: str, slog_file
103112 Returns:
104113 dict: A dictionary with 'status' ('success' or 'error') and 'content' (message or error details).
105114 """
115+ if API_BASE_URL == 'NOSERVER' :
116+ logging .info ('API_BASE_URL set to NOSERVER, skipping upload' )
117+ return {"status" : "success" , "content" : "Data upload skipped." }
118+
106119 url = f"{ API_BASE_URL } /taskcontrol"
107120 slog_file_path = Path (data_directory ) / slog_file_name
108121
@@ -169,12 +182,13 @@ def retrieve_worker_id() -> dict[str, str]:
169182 dict: A dictionary with 'status' and 'content' containing the worker ID or error message.
170183 """
171184 if RUNNING_FROM_EXECUTABLE :
185+
172186 # Select appropriate worker ID retrieval function based on OS
173187 os_worker_id_function = {
174188 'Windows' : _read_exe_worker_id ,
175189 'Darwin' : _read_app_worker_id
176190 }.get (CURRENT_OS , lambda : {'status' : 'error' , 'content' : 'Unsupported OS' })
177-
191+
178192 return os_worker_id_function ()
179193
180194 return {'status' : 'error' , 'content' : 'Not running from an executable' }
0 commit comments