Skip to content

Commit 5686a80

Browse files
committed
[Localhost] Fix function get_obj
1 parent fc347c5 commit 5686a80

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

lithops/localhost/v1/localhost.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ def job_manager():
114114
logger.debug(f'ExecutorID {executor_id} | JobID {job_id} - Running '
115115
f'{total_calls} activations in the localhost worker')
116116
process = self.env.run_job(job_key, job_filename)
117-
stdout, stderr = process.communicate() # blocks until the process finishes
117+
process.communicate() # blocks until the process finishes
118118
if process.returncode != 0:
119-
logger.error(f"ExecutorID {executor_id} | JobID {job_id} - Job failed with return code {process.returncode}")
120-
logger.error(f"ExecutorID {executor_id} | JobID {job_id} - Error output from job process: {stderr}")
119+
logger.error(f"ExecutorID {executor_id} | JobID {job_id} - Job "
120+
f"process failed with return code {process.returncode}")
121121
logger.debug(f'ExecutorID {executor_id} | JobID {job_id} - Execution finished')
122122

123123
if self.job_queue.empty():

lithops/localhost/v2/localhost.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,9 @@ def run_task(self, job_key, call_id):
323323
cmd = [self.runtime_name, RUNNER_FILE, 'run_job', task_filename]
324324
process = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.PIPE, start_new_session=True)
325325
self.task_processes[job_key_call_id] = process
326-
stdout, stderr = process.communicate() # blocks until the process finishes
326+
process.communicate() # blocks until the process finishes
327327
if process.returncode != 0:
328328
logger.error(f"Task process {job_key_call_id} failed with return code {process.returncode}")
329-
logger.error(f"Error output from task process {job_key_call_id}: {stderr}")
330329
del self.task_processes[job_key_call_id]
331330
logger.debug(f"Task process {job_key_call_id} finished")
332331

@@ -439,11 +438,9 @@ def run_task(self, job_key, call_id):
439438

440439
process = sp.Popen(shlex.split(cmd), stdout=sp.PIPE, stderr=sp.PIPE, start_new_session=True)
441440
self.task_processes[job_key_call_id] = process
442-
stdout, stderr = process.communicate() # blocks until the process finishes
441+
process.communicate() # blocks until the process finishes
443442
if process.returncode != 0:
444443
logger.error(f"Task process {job_key_call_id} failed with return code {process.returncode}")
445-
logger.error(f"Error output from task process {job_key_call_id}: {stderr}")
446-
del self.task_processes[job_key_call_id]
447444
logger.debug(f"Task process {job_key_call_id} finished")
448445

449446
def stop(self, job_keys=None):

lithops/worker/utils.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,9 @@ def get_function_and_modules(job, internal_storage):
5858
func_path = '/'.join([SA_INSTALL_DIR, job.func_key])
5959
with open(func_path, "rb") as f:
6060
func_obj = f.read()
61-
elif os.path.exists(func_path):
62-
logger.info(f"Loading {job.func_key} from local cache")
63-
try:
64-
with open(func_path, 'rb') as f:
65-
func_obj = f.read()
66-
except Exception:
67-
logger.debug(f"Could not load {job.func_key} from local cache")
68-
69-
if not func_obj:
61+
else:
7062
logger.info(f"Loading {job.func_key} from storage")
7163
func_obj = internal_storage.get_func(job.func_key)
72-
os.makedirs(os.path.dirname(func_path), exist_ok=True)
73-
with open(func_path, 'wb') as f:
74-
f.write(func_obj)
7564

7665
loaded_func_all = pickle.loads(func_obj)
7766

0 commit comments

Comments
 (0)