Jug Tasks spanning multiple files

17 views
Skip to first unread message

samuel_a...@brown.edu

unread,
Aug 14, 2015, 5:02:04 PM8/14/15
to jug-users
Hi, as someone who has struggled repeatedly with exactly the problem that jug attempts to solve, I'm excited in getting up and running with the project. However, a lot of my projects/code/scripts span multiple files and it's not clear to me from the documentation that jug supports such a setup. For example, say I have a setup as follows:

util.py
def calc_features(filename, parameters):
   
# long computation, reused extensively

approach1.py
from util import calc_features

# ... Tasks that make use of calc_features

approach2.py
from util import calc_features

# ... Other Tasks that reuse calc_features in some other way

If I simply annotate calc_features as a TaskGenerator in util.py I'd like the cached results from calc_features to be reused across both approach1.py and approach2.py. Is this possible?

Best,
Samuel

Luis Pedro Coelho

unread,
Aug 15, 2015, 3:28:58 PM8/15/15
to jug-...@googlegroups.com
Hi Samuel,

Yes, jug can work just fine in this setting. If you want to keep the
files separate (as opposed to having a master jugfile.py script), you do
need to make sure that they all use the same backend.

This can be done on the command line:

jug execute approach1.py --jugdir my_shared_directory
jug execute approach2.py --jugdir my_shared_directory
...

or in the scripts themselves:

from jug import set_jugdir
set_jugdir('my_shared_directory')

HTH
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
> --
> You received this message because you are subscribed to the Google Groups
> "jug-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jug-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

samuel_a...@brown.edu

unread,
Aug 16, 2015, 2:33:01 AM8/16/15
to jug-users
Great, I'm glad to hear it! Playing around with it now...

Best,
Samuel
Reply all
Reply to author
Forward
0 new messages