Skip to content

Commit

Permalink
BUG Fix for pack and local imports
Browse files Browse the repository at this point in the history
If the Jugfile imports a function from a local file (which is then used
as a Task), this would not unpickle correctly as the unpickling is done
*before* loading the Jugfile
  • Loading branch information
luispedro committed Apr 3, 2024
1 parent ef66785 commit b6c7a23
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Unreleased
* Support for lambda functions in Tasklets
* Tasklet: Support for lambda functions in Tasklets
* pack: bugfix when using local imports

Version 2.3.1 Sun 5 November 2023 by luispedro
* jug: update for Python 3.12
Expand Down
4 changes: 3 additions & 1 deletion jug/backends/file_store.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2022, Luis Pedro Coelho <[email protected]>
# Copyright (C) 2008-2024, Luis Pedro Coelho <[email protected]>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -78,7 +78,9 @@ def __init__(self, dname, compress_numpy=False):
self.packed = {}
if path.exists(self._packfile()):
with open(self._packfile(), 'rb') as pfile:
sys.path.insert(0, '.')
self.packed = decode_from(pfile)
del sys.path[0]

def _packfile(self):
return path.join(self.jugdir, 'packs', 'jugpack')
Expand Down
2 changes: 1 addition & 1 deletion jug/jug_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '2.3.1'
__version__ = '2.4.0'
CITATION = '''\
Coelho, L.P., (2017). Jug: Software for Parallel Reproducible Computation in
Python. Journal of Open Research Software. 5(1), p.30.
Expand Down

0 comments on commit b6c7a23

Please sign in to comment.