Skip to content

Commit

Permalink
test_inmemory.py / test_pickle.py
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Nov 27, 2024
1 parent 86667a6 commit 047a830
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
10 changes: 0 additions & 10 deletions test/persistence/test_inmemory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
import asyncio
import unittest

import plumpy
Expand All @@ -13,16 +12,11 @@ def test_save_load_roundtrip(self):
Test the plumpy.PicklePersister by taking a dummpy process, saving a checkpoint
and recreating it from the same checkpoint
"""
loop = asyncio.get_event_loop()
process = ProcessWithCheckpoint()

persister = plumpy.InMemoryPersister()
persister.save_checkpoint(process)

bundle = persister.load_checkpoint(process.pid)
load_context = plumpy.LoadSaveContext(loop=loop)
recreated = bundle.unbundle(load_context)

def test_get_checkpoints_without_tags(self):
""" """
process_a = ProcessWithCheckpoint()
Expand Down Expand Up @@ -68,8 +62,6 @@ def test_get_process_checkpoints(self):

checkpoint_a1 = plumpy.PersistedCheckpoint(process_a.pid, '1')
checkpoint_a2 = plumpy.PersistedCheckpoint(process_a.pid, '2')
checkpoint_b1 = plumpy.PersistedCheckpoint(process_b.pid, '1')
checkpoint_b2 = plumpy.PersistedCheckpoint(process_b.pid, '2')

checkpoints = [checkpoint_a1, checkpoint_a2]

Expand All @@ -90,8 +82,6 @@ def test_delete_process_checkpoints(self):

checkpoint_a1 = plumpy.PersistedCheckpoint(process_a.pid, '1')
checkpoint_a2 = plumpy.PersistedCheckpoint(process_a.pid, '2')
checkpoint_b1 = plumpy.PersistedCheckpoint(process_b.pid, '1')
checkpoint_b2 = plumpy.PersistedCheckpoint(process_b.pid, '2')

persister = plumpy.InMemoryPersister()
persister.save_checkpoint(process_a, tag='1')
Expand Down
10 changes: 0 additions & 10 deletions test/persistence/test_pickle.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
import asyncio
import tempfile
import unittest

Expand All @@ -17,17 +16,12 @@ def test_save_load_roundtrip(self):
Test the plumpy.PicklePersister by taking a dummpy process, saving a checkpoint
and recreating it from the same checkpoint
"""
loop = asyncio.get_event_loop()
process = ProcessWithCheckpoint()

with tempfile.TemporaryDirectory() as directory:
persister = plumpy.PicklePersister(directory)
persister.save_checkpoint(process)

bundle = persister.load_checkpoint(process.pid)
load_context = plumpy.LoadSaveContext(loop=loop)
recreated = bundle.unbundle(load_context)

def test_get_checkpoints_without_tags(self):
""" """
process_a = ProcessWithCheckpoint()
Expand Down Expand Up @@ -75,8 +69,6 @@ def test_get_process_checkpoints(self):

checkpoint_a1 = plumpy.PersistedCheckpoint(process_a.pid, '1')
checkpoint_a2 = plumpy.PersistedCheckpoint(process_a.pid, '2')
checkpoint_b1 = plumpy.PersistedCheckpoint(process_b.pid, '1')
checkpoint_b2 = plumpy.PersistedCheckpoint(process_b.pid, '2')

checkpoints = [checkpoint_a1, checkpoint_a2]

Expand All @@ -98,8 +90,6 @@ def test_delete_process_checkpoints(self):

checkpoint_a1 = plumpy.PersistedCheckpoint(process_a.pid, '1')
checkpoint_a2 = plumpy.PersistedCheckpoint(process_a.pid, '2')
checkpoint_b1 = plumpy.PersistedCheckpoint(process_b.pid, '1')
checkpoint_b2 = plumpy.PersistedCheckpoint(process_b.pid, '2')

with tempfile.TemporaryDirectory() as directory:
persister = plumpy.PicklePersister(directory)
Expand Down

0 comments on commit 047a830

Please sign in to comment.