Skip to content

Commit

Permalink
Merge pull request #356 from ipelupessy/refactor_async2
Browse files Browse the repository at this point in the history
various improvements of async requests:
- handling of exceptions
- allow normal call when async is in progress
- request can be indexed
- requests can be used as arguments to code function calls
- requests can be unpacked, ie a,b=code.funct(return_request=True)
- requests can be combined in expressions (resulting in new request)
- put async stuff in seperate file
  • Loading branch information
ipelupessy authored Jan 17, 2019
2 parents 5565506 + 1c75aed commit ec0c391
Show file tree
Hide file tree
Showing 13 changed files with 1,281 additions and 568 deletions.
2 changes: 1 addition & 1 deletion src/amuse/datamodel/incode_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
from amuse.datamodel import Grid
from amuse.datamodel import AttributeStorage

from amuse.rfi.channel import ASyncRequestSequence
from amuse.rfi.async_request import ASyncRequestSequence

class ParticleMappingMethod(AbstractCodeMethodWrapper):
def __init__(self, method, attribute_names = None):
Expand Down
3 changes: 1 addition & 2 deletions src/amuse/datamodel/memory_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from amuse.units.quantities import is_quantity
from amuse.datamodel.base import *
from amuse.support import exceptions
from amuse.rfi.async_request import FakeASyncRequest

try:
if numpy.uintp().itemsize<8: raise Exception()
Expand Down Expand Up @@ -110,7 +111,6 @@ def get_values_in_store(self, indices, attributes):
return results

def get_values_in_store_async(self, indices, attributes):
from amuse.rfi.channel import FakeASyncRequest
result = self.get_values_in_store(indices, attributes)
return FakeASyncRequest(result)

Expand Down Expand Up @@ -146,7 +146,6 @@ def set_values_in_store(self, indices, attributes, list_of_values_to_set):
raise AttributeError("exception in setting attribute '{0}', error was '{1}'".format(attribute, ex))

def set_values_in_store_async(self, indices, attributes, list_of_values_to_set):
from amuse.rfi.channel import FakeASyncRequest
result = self.set_values_in_store(indices, attributes, list_of_values_to_set)
return FakeASyncRequest(result)

Expand Down
2 changes: 1 addition & 1 deletion src/amuse/ext/job_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"""
from amuse.rfi.core import *
import cPickle as pickle
from amuse.rfi.channel import AsyncRequestsPool
from amuse.rfi.async_request import AsyncRequestsPool
import inspect
from collections import deque
import threading
Expand Down
Loading

0 comments on commit ec0c391

Please sign in to comment.