Skip to content

Commit

Permalink
fix: register list & dict value data
Browse files Browse the repository at this point in the history
  • Loading branch information
makkus committed Apr 17, 2024
1 parent 61ec4f3 commit 17261e7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/kiara/data_types/included_core_types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,14 @@ def parse_python_obj(self, data: Any) -> KiaraDict:
dict_data = orjson.loads(data)
schema = {"title": "dict", "type": "object"}
except Exception:
pass
try:
from kiara.utils.cli import dict_from_cli_args

tokens = data.split(",")
dict_data = dict_from_cli_args(*tokens)
schema = {"title": "dict", "type": "object"}
except Exception:
pass

if dict_data is None or schema is None:
raise Exception(f"Invalid data for value type 'dict': {data}")
Expand Down
1 change: 1 addition & 0 deletions src/kiara/registries/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,7 @@ def _create_value(

data_type: Union[None, DataType] = None
if reuse_existing and not isinstance(data, (Value, uuid.UUID, SpecialValue)):

data_type = self._kiara.type_registry.retrieve_data_type(
data_type_name=schema.type, data_type_config=schema.type_config
)
Expand Down
7 changes: 5 additions & 2 deletions src/kiara/registries/data/data_store/sqlite_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,13 @@ def _find_values_with_hash(
raise NotImplementedError()

sql = text(
f"SELECT value_id FROM {TABLE_NAME_DATA_METADATA} WHERE value_hash = ?"
f"SELECT value_id FROM {TABLE_NAME_DATA_METADATA} WHERE value_hash = :value_hash"
)
params = {
"value_hash": value_hash,
}
with self.sqlite_engine.connect() as conn:
cursor = conn.execute(sql, (value_hash,))
cursor = conn.execute(sql, parameters=params)
result = cursor.fetchall()
return {uuid.UUID(x[0]) for x in result}

Expand Down
6 changes: 5 additions & 1 deletion src/kiara/registries/jobs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,11 @@ def get_job_record(self, job_id: uuid.UUID) -> JobRecord:
if r.job_id == job_id:
return r

raise NotImplementedError()
# raise a FailedJobException if the job is in the failed jobs list
self.get_active_job(job_id=job_id)

# this should never happen
raise KiaraException("Can't find job record with id: {job_id}")

def find_job_records(self, matcher: JobMatcher) -> Mapping[uuid.UUID, JobRecord]:

Expand Down

0 comments on commit 17261e7

Please sign in to comment.