Skip to content

Commit

Permalink
state: allow deserialization options
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasheinrich committed Oct 18, 2017
1 parent a47b1a3 commit cb99b61
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packtivity/backendutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
log = logging.getLogger(__name__)


def proxy_from_json(jsondata, deserialization_opts = None, best_effort_backend = True, raise_on_unknown = False):
def load_proxy(jsondata, deserialization_opts = None, best_effort_backend = True, raise_on_unknown = False):
deserialization_opts = deserialization_opts or {}
proxy, backend = None, None
if jsondata['proxyname'] == 'CeleryProxy':
Expand Down
4 changes: 2 additions & 2 deletions packtivity/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def validatecli(spec,toplevel,schemasource,schemaname,show):
@click.argument('jsonfile')
def checkproxy(jsonfile):
proxydata = json.load(open(jsonfile))
proxy, backend = bkutils.proxy_from_json(proxydata, best_effort_backend = True)
proxy, backend = bkutils.load_proxy(proxydata, best_effort_backend = True)

ready = backend.ready(proxy)

Expand All @@ -119,4 +119,4 @@ def checkproxy(jsonfile):
click.secho('successful: {}'.format(successful))
if successful:
result = backend.result(proxy)
click.secho('result: {}'.format(json.dumps(result)))
click.secho('result: {}'.format(json.dumps(result)))
3 changes: 2 additions & 1 deletion packtivity/statecontexts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ def load_state(jsondata):
return module.load_state(jsondata)
raise TypeError('unknown state type {}'.format(jsondata['state_type']))

def load_provider(jsondata):
def load_provider(jsondata,deserialization_opts = None):
deserialization_opts = deserialization_opts or {}
if jsondata == None:
return None
if jsondata['state_provider_type'] == 'localfs_provider':
Expand Down

0 comments on commit cb99b61

Please sign in to comment.