Skip to content

Commit

Permalink
Merge pull request #1344 from JosepSampe/lithops-dev
Browse files Browse the repository at this point in the history
Fix some potential issues
  • Loading branch information
JosepSampe authored May 11, 2024
2 parents 8bb9cea + e9766d8 commit 035b94b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ jobs:

outputs:
localhost: ${{ steps.script.outputs.localhost }}
ibm_cf: ${{ steps.script.outputs.ibm_cf }}
code_engine: ${{ steps.script.outputs.code_engine }}

steps:
- name: Set jobs to run
id: script
run: |
echo "localhost=true" >> $GITHUB_OUTPUT
echo "ibm_cf=false" >> $GITHUB_OUTPUT
echo "code_engine=false" >> $GITHUB_OUTPUT
Expand All @@ -35,10 +33,10 @@ jobs:

steps:
- name: Clone Lithops repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand All @@ -59,10 +57,10 @@ jobs:

steps:
- name: Clone Lithops repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:

steps:
- name: Clone Lithops repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -43,10 +43,10 @@ jobs:

steps:
- name: Clone Lithops repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand Down
5 changes: 4 additions & 1 deletion lithops/localhost/v2/localhost.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,10 @@ def kill_process(process):
for job_key_call_id in list(self.task_processes.keys()):
if job_key_call_id.startswith(job_key):
process = self.task_processes[job_key_call_id]
kill_process(process)
try:
kill_process(process)
except Exception:
pass
self.task_processes[job_key_call_id] = None

super().stop(job_keys)
Expand Down
3 changes: 2 additions & 1 deletion lithops/worker/jobrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os
import io
import sys
import ast
import pika
import time
import pickle
Expand Down Expand Up @@ -209,7 +210,7 @@ def run(self):
func = pickle.loads(self.job.func)
data = pickle.loads(self.job.data)

if eval(os.environ.get('__LITHOPS_REDUCE_JOB', 'False')):
if ast.literal_eval(os.environ.get('__LITHOPS_REDUCE_JOB', 'False')):
self._wait_futures(data)
elif is_object_processing_function(func):
self._load_object(data)
Expand Down
3 changes: 2 additions & 1 deletion lithops/worker/status.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import ast
import pika
import json
import time
Expand Down Expand Up @@ -44,7 +45,7 @@ def __init__(self, job, internal_storage):
'chunksize': job.chunksize
}

if eval(os.environ.get('WARM_CONTAINER', 'False')):
if ast.literal_eval(os.environ.get('WARM_CONTAINER', 'False')):
self.status['worker_cold_start'] = False
else:
self.status['worker_cold_start'] = True
Expand Down

0 comments on commit 035b94b

Please sign in to comment.