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

fix: add handling for wrapped run to pickle #401

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions test/test_task_on_kart.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import pathlib
import pickle
import unittest
from datetime import datetime
from typing import Any, Dict, List, cast
Expand Down Expand Up @@ -657,5 +658,18 @@ def test_run_when_complete_check_at_run_is_true_and_task_is_completed(self):
task.dump.assert_not_called()


class TestPickleTaskOnKart:
def test_pickle_and_unpickle(self):
task = _DummyTask(redis_host='0.0.0.0', redis_port=12345, redis_timeout=180, should_lock_run=True)
pickled = pickle.dumps(task)
mski-iksm marked this conversation as resolved.
Show resolved Hide resolved
unpickled = pickle.loads(pickled)
assert task.to_str_params() == unpickled.to_str_params()

task = _DummyTask(should_lock_run=False)
pickled = pickle.dumps(task)
unpickled = pickle.loads(pickled)
assert task.to_str_params() == unpickled.to_str_params()


if __name__ == '__main__':
unittest.main()
Loading