Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhashable types #75

Closed
lars-reimann opened this issue Apr 3, 2024 · 2 comments · Fixed by #80
Closed

Unhashable types #75

lars-reimann opened this issue Apr 3, 2024 · 2 comments · Fixed by #80
Assignees
Labels
bug 🪲 Something isn't working released Included in a release

Comments

@lars-reimann
Copy link
Member

lars-reimann commented Apr 3, 2024

Describe the bug

Trying to memoize unhashable values leads to errors. This includes, e.g. values of type dict. The memoized_call method should be more robust in this case.

To Reproduce

Example:

package test

pipeline myPipeline {
    val a = Table({
        "a": [1, 2, 3],
        "b": [4, 5, 6]
    });
}

Runner output:

2024-04-03 17:34:16.380 [info] Launching Pipeline (6b9aaa93-0ce7-444e-9c1e-839cb106ec80): file:///c%3A/Users/Lars/OneDrive/Desktop/test/test.sdstest - myPipeline
2024-04-03 17:34:16.380 [info] Sending message to python server: {"type":"program","id":"6b9aaa93-0ce7-444e-9c1e-839cb106ec80","data":{"code":{"test":{"gen_test":"# Imports ----------------------------------------------------------------------\r\n\r\nimport safeds_runner\r\nfrom safeds.data.tabular.containers import Table\r\n\r\n# Pipelines --------------------------------------------------------------------\r\n\r\ndef myPipeline():\r\n    a = safeds_runner.memoized_call(\"safeds.data.tabular.containers.Table\", lambda *_ : Table(data={'a': [1, 2, 3], 'b': [4, 5, 6]}), [{'a': [1, 2, 3], 'b': [4, 5, 6]}], [])\r\n    safeds_runner.save_placeholder('a', a)\r\n","gen_test_myPipeline":"from .gen_test import myPipeline\r\n\r\nif __name__ == '__main__':\r\n    myPipeline()\r\n"}},"main":{"modulepath":"test","module":"test","pipeline":"myPipeline"}}}
2024-04-03 17:34:16.381 [info] [Runner-Err] DEBUG:root:Received Message: {"type":"program","id":"6b9aaa93-0ce7-444e-9c1e-839cb106ec80","data":{"code":{"test":{"gen_test":"# Imports ----------------------------------------------------------------------\r\n\r\nimport safeds_runner\r\nfrom safeds.data.tabular.containers import Table\r\n\r\n# Pipelines --------------------------------------------------------------------\r\n\r\ndef myPipeline():\r\n    a = safeds_runner.memoized_call(\"safeds.data.tabular.containers.Table\", lambda *_ : Table(data={'a': [1, 2, 3], 'b': [4, 5, 6]}), [{'a': [1, 2, 3], 'b': [4, 5, 6]}], [])\r\n    safeds_runner.save_placeholder('a', a)\r\n","gen_test_myPipeline":"from .gen_test import myPipeline\r\n\r\nif __name__ == '__main__':\r\n    myPipeline()\r\n"}},"main":{"modulepath":"test","module":"test","pipeline":"myPipeline"}}}
2024-04-03 17:34:18.959 [info] [Runner] Message received: '{"type": "runtime_error", "id": "6b9aaa93-0ce7-444e-9c1e-839cb106ec80", "data": {"message": "unhashable type: 'dict'", "backtrac<truncated>'

Expected behavior

  1. Detect whether any values are unhashable and then do a normal function call without memoization.
  2. If possible, dict should be made hashable, since it might occur quite frequently.

Screenshots (optional)

No response

Additional Context (optional)

No response

@lars-reimann lars-reimann added the bug 🪲 Something isn't working label Apr 3, 2024
@lars-reimann lars-reimann added this to DSL Apr 3, 2024
@github-project-automation github-project-automation bot moved this to Backlog in DSL Apr 3, 2024
@lars-reimann lars-reimann moved this from Backlog to Todo in DSL Apr 5, 2024
@lars-reimann lars-reimann self-assigned this Apr 8, 2024
lars-reimann added a commit that referenced this issue Apr 8, 2024
Closes #75
Closes #79

### Summary of Changes

* Catch errors when attempting to pickle/hash a value.
* Make dicts and lambdas serializable.

---------

Co-authored-by: WinPlay02 <[email protected]>
Co-authored-by: megalinter-bot <[email protected]>
@github-project-automation github-project-automation bot moved this from Todo to ✔️ Done in DSL Apr 8, 2024
lars-reimann pushed a commit that referenced this issue Apr 9, 2024
## [0.8.1](v0.8.0...v0.8.1) (2024-04-09)

### Bug Fixes

* **deps:** bump pillow from 10.2.0 to 10.3.0 ([#77](#77)) ([32974d0](32974d0)), closes [#7928](https://github.com/Safe-DS/Runner/issues/7928) [#7912](https://github.com/Safe-DS/Runner/issues/7912) [#7883](https://github.com/Safe-DS/Runner/issues/7883) [#7925](https://github.com/Safe-DS/Runner/issues/7925) [#7920](https://github.com/Safe-DS/Runner/issues/7920) [#7818](https://github.com/Safe-DS/Runner/issues/7818) [#7918](https://github.com/Safe-DS/Runner/issues/7918) [#7658](https://github.com/Safe-DS/Runner/issues/7658) [#7209](https://github.com/Safe-DS/Runner/issues/7209) [#7884](https://github.com/Safe-DS/Runner/issues/7884) [#7888](https://github.com/Safe-DS/Runner/issues/7888) [#7894](https://github.com/Safe-DS/Runner/issues/7894) [#7900](https://github.com/Safe-DS/Runner/issues/7900) [#7891](https://github.com/Safe-DS/Runner/issues/7891) [#7893](https://github.com/Safe-DS/Runner/issues/7893) [#7882](https://github.com/Safe-DS/Runner/issues/7882) [#7870](https://github.com/Safe-DS/Runner/issues/7870) [#7872](https://github.com/Safe-DS/Runner/issues/7872) [#7881](https://github.com/Safe-DS/Runner/issues/7881) [#7880](https://github.com/Safe-DS/Runner/issues/7880) [#7644](https://github.com/Safe-DS/Runner/issues/7644) [#7753](https://github.com/Safe-DS/Runner/issues/7753) [#7706](https://github.com/Safe-DS/Runner/issues/7706) [#7791](https://github.com/Safe-DS/Runner/issues/7791) [#7788](https://github.com/Safe-DS/Runner/issues/7788) [#7823](https://github.com/Safe-DS/Runner/issues/7823) [#7840](https://github.com/Safe-DS/Runner/issues/7840) [#7842](https://github.com/Safe-DS/Runner/issues/7842) [#7821](https://github.com/Safe-DS/Runner/issues/7821) [#7797](https://github.com/Safe-DS/Runner/issues/7797) [#7798](https://github.com/Safe-DS/Runner/issues/7798) [#7713](https://github.com/Safe-DS/Runner/issues/7713) [#7827](https://github.com/Safe-DS/Runner/issues/7827) [#7838](https://github.com/Safe-DS/Runner/issues/7838) [#7843](https://github.com/Safe-DS/Runner/issues/7843) [#7852](https://github.com/Safe-DS/Runner/issues/7852) [#7855](https://github.com/Safe-DS/Runner/issues/7855) [#7849](https://github.com/Safe-DS/Runner/issues/7849) [#7709](https://github.com/Safe-DS/Runner/issues/7709) [#7779](https://github.com/Safe-DS/Runner/issues/7779) [#7841](https://github.com/Safe-DS/Runner/issues/7841) [#7782](https://github.com/Safe-DS/Runner/issues/7782) [#7804](https://github.com/Safe-DS/Runner/issues/7804) [#7810](https://github.com/Safe-DS/Runner/issues/7810) [#7744](https://github.com/Safe-DS/Runner/issues/7744) [#7928](https://github.com/Safe-DS/Runner/issues/7928) [#7927](https://github.com/Safe-DS/Runner/issues/7927) [#7883](https://github.com/Safe-DS/Runner/issues/7883) [#7818](https://github.com/Safe-DS/Runner/issues/7818) [#7918](https://github.com/Safe-DS/Runner/issues/7918) [#7920](https://github.com/Safe-DS/Runner/issues/7920) [#7658](https://github.com/Safe-DS/Runner/issues/7658) [#7209](https://github.com/Safe-DS/Runner/issues/7209) [#7884](https://github.com/Safe-DS/Runner/issues/7884) [#7888](https://github.com/Safe-DS/Runner/issues/7888) [#7894](https://github.com/Safe-DS/Runner/issues/7894) [#7900](https://github.com/Safe-DS/Runner/issues/7900) [#7891](https://github.com/Safe-DS/Runner/issues/7891) [#7893](https://github.com/Safe-DS/Runner/issues/7893) [#7882](https://github.com/Safe-DS/Runner/issues/7882) [#7870](https://github.com/Safe-DS/Runner/issues/7870) [#7872](https://github.com/Safe-DS/Runner/issues/7872) [#7928](https://github.com/Safe-DS/Runner/issues/7928) [#7927](https://github.com/Safe-DS/Runner/issues/7927)
* dynamic memoization calls ([#82](#82)) ([172b398](172b398))
* more robust hashing & pickling when memoizing ([#80](#80)) ([25c49e2](25c49e2)), closes [#75](#75) [#79](#79)
@lars-reimann
Copy link
Member Author

🎉 This issue has been resolved in version 0.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lars-reimann lars-reimann added the released Included in a release label Apr 9, 2024
lars-reimann pushed a commit that referenced this issue Apr 9, 2024
## [0.9.0](v0.8.0...v0.9.0) (2024-04-09)

### Features

* dynamic memoization calls ([#82](#82)) ([9d31292](9d31292))

### Bug Fixes

* **deps:** bump pillow from 10.2.0 to 10.3.0 ([#77](#77)) ([32974d0](32974d0)), closes [#7928](https://github.com/Safe-DS/Runner/issues/7928) [#7912](https://github.com/Safe-DS/Runner/issues/7912) [#7883](https://github.com/Safe-DS/Runner/issues/7883) [#7925](https://github.com/Safe-DS/Runner/issues/7925) [#7920](https://github.com/Safe-DS/Runner/issues/7920) [#7818](https://github.com/Safe-DS/Runner/issues/7818) [#7918](https://github.com/Safe-DS/Runner/issues/7918) [#7658](https://github.com/Safe-DS/Runner/issues/7658) [#7209](https://github.com/Safe-DS/Runner/issues/7209) [#7884](https://github.com/Safe-DS/Runner/issues/7884) [#7888](https://github.com/Safe-DS/Runner/issues/7888) [#7894](https://github.com/Safe-DS/Runner/issues/7894) [#7900](https://github.com/Safe-DS/Runner/issues/7900) [#7891](https://github.com/Safe-DS/Runner/issues/7891) [#7893](https://github.com/Safe-DS/Runner/issues/7893) [#7882](https://github.com/Safe-DS/Runner/issues/7882) [#7870](https://github.com/Safe-DS/Runner/issues/7870) [#7872](https://github.com/Safe-DS/Runner/issues/7872) [#7881](https://github.com/Safe-DS/Runner/issues/7881) [#7880](https://github.com/Safe-DS/Runner/issues/7880) [#7644](https://github.com/Safe-DS/Runner/issues/7644) [#7753](https://github.com/Safe-DS/Runner/issues/7753) [#7706](https://github.com/Safe-DS/Runner/issues/7706) [#7791](https://github.com/Safe-DS/Runner/issues/7791) [#7788](https://github.com/Safe-DS/Runner/issues/7788) [#7823](https://github.com/Safe-DS/Runner/issues/7823) [#7840](https://github.com/Safe-DS/Runner/issues/7840) [#7842](https://github.com/Safe-DS/Runner/issues/7842) [#7821](https://github.com/Safe-DS/Runner/issues/7821) [#7797](https://github.com/Safe-DS/Runner/issues/7797) [#7798](https://github.com/Safe-DS/Runner/issues/7798) [#7713](https://github.com/Safe-DS/Runner/issues/7713) [#7827](https://github.com/Safe-DS/Runner/issues/7827) [#7838](https://github.com/Safe-DS/Runner/issues/7838) [#7843](https://github.com/Safe-DS/Runner/issues/7843) [#7852](https://github.com/Safe-DS/Runner/issues/7852) [#7855](https://github.com/Safe-DS/Runner/issues/7855) [#7849](https://github.com/Safe-DS/Runner/issues/7849) [#7709](https://github.com/Safe-DS/Runner/issues/7709) [#7779](https://github.com/Safe-DS/Runner/issues/7779) [#7841](https://github.com/Safe-DS/Runner/issues/7841) [#7782](https://github.com/Safe-DS/Runner/issues/7782) [#7804](https://github.com/Safe-DS/Runner/issues/7804) [#7810](https://github.com/Safe-DS/Runner/issues/7810) [#7744](https://github.com/Safe-DS/Runner/issues/7744) [#7928](https://github.com/Safe-DS/Runner/issues/7928) [#7927](https://github.com/Safe-DS/Runner/issues/7927) [#7883](https://github.com/Safe-DS/Runner/issues/7883) [#7818](https://github.com/Safe-DS/Runner/issues/7818) [#7918](https://github.com/Safe-DS/Runner/issues/7918) [#7920](https://github.com/Safe-DS/Runner/issues/7920) [#7658](https://github.com/Safe-DS/Runner/issues/7658) [#7209](https://github.com/Safe-DS/Runner/issues/7209) [#7884](https://github.com/Safe-DS/Runner/issues/7884) [#7888](https://github.com/Safe-DS/Runner/issues/7888) [#7894](https://github.com/Safe-DS/Runner/issues/7894) [#7900](https://github.com/Safe-DS/Runner/issues/7900) [#7891](https://github.com/Safe-DS/Runner/issues/7891) [#7893](https://github.com/Safe-DS/Runner/issues/7893) [#7882](https://github.com/Safe-DS/Runner/issues/7882) [#7870](https://github.com/Safe-DS/Runner/issues/7870) [#7872](https://github.com/Safe-DS/Runner/issues/7872) [#7928](https://github.com/Safe-DS/Runner/issues/7928) [#7927](https://github.com/Safe-DS/Runner/issues/7927)
* more robust hashing & pickling when memoizing ([#80](#80)) ([25c49e2](25c49e2)), closes [#75](#75) [#79](#79)
@lars-reimann
Copy link
Member Author

🎉 This issue has been resolved in version 0.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working released Included in a release
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant