Skip to content

Commit

Permalink
Merge branch '3.0' of github.com:populse/capsul into 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nsouedet committed Apr 29, 2024
2 parents 18e589c + 0971f6b commit 5796a87
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/test-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,12 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.9"

- name: Install Redis
run: |
sudo apt update
sudo apt install redis-server
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion capsul/config/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class EngineConfiguration(Controller):
python_modules: list[str]

database: str = "builtin"
persistent: bool
persistent: bool = True

start_workers: field(
type_=dict, default_factory=lambda: default_engine_start_workers
Expand Down
12 changes: 7 additions & 5 deletions capsul/database/populse_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def engine_id(self, label):
label=label, fields=["engine_id"], as_list=True
)
if s:
return s[0]
return s[0][0]

def _enter(self):
self.uuid = str(uuid4())
Expand Down Expand Up @@ -129,7 +129,7 @@ def get_or_create_engine(self, engine, update_database=False):
if persistent is undefined:
persistent = db.tmp.get() is None
if row:
engine_id = row[0]
engine_id = row[0][0]
if update_database:
# Update configuration stored in database
db.capsul_engine[engine_id].update(
Expand Down Expand Up @@ -219,7 +219,6 @@ def dispose_engine(self, engine_id):
if row:
connections, persistent, executions = row
connections -= 1
db.capsul_engine[engine_id].label = None
if connections == 0 and not persistent:
# Check if some executions had not been disposed
erase = True
Expand Down Expand Up @@ -260,7 +259,6 @@ def executions_summary(self, engine_id):
"done",
"failed",
],
as_list=True,
)
if info:
for i in ("waiting", "ready", "ongoing", "done", "failed"):
Expand Down Expand Up @@ -329,7 +327,11 @@ def pop_job_json(self, engine_id, start_time):
if not os.path.exists(self.path):
return None, None
with self.storage.data(write=True) as db:
executions = db.capsul_engine[engine_id].executions.get()
if db is None:
# database doesn't exist anymore
executions = None
else:
executions = db.capsul_engine[engine_id].executions.get()
if executions is None:
# engine_id does not exist anymore
# return None to say to workers that they can die
Expand Down

0 comments on commit 5796a87

Please sign in to comment.