Hi,
I've implemented all these in
https://github.com/hashdist/hashdist/pull/325. Below I show how to use
it:
certik@redhawk:~$ hit list-profiles
List of installed profiles (profile_name@profile_hash):
basis@k4g2r7wjqcth
truchas@ws2qspqle76r
py32@loglud5apymb
py3@DELETED
py34@htvz74mbenv5
xx@d34x65pdbsxt
hd_base@bto56eplrk4v
b@DELETED
test@vndgqtgsmdth
rhel6@5vq4exlhbnuj
python3.4.linux@yt6dksb4bzp3
temp@ehcfjfeibvh5
gtk@mgz74vgzjtdp
py33@opqanpz7bwzd
default@lcbhm255ymgh
py27@pcnu7kh736at
numpy@kkhizx2z6ea4
truchas_bootstrap@frxnfq2suzik
>
>
> I manually pruned the output of "ls" to only show the links to
> profiles. I counted 13 of them.
> A collaborator just sent me his Python 3 files (some Python modules
> and IPython notebook). I want to try them out. So I go to /tmp/x
> directory with the files, and:
>
> certik@redhawk:/tmp/x$ export HASHSTACK=$HOME/repos/hashstack/py34
> certik@redhawk:/tmp/x$ export PATH=$HASHSTACK/bin:$PATH
certik@redhawk:~$ hit load py34
export HASHSTACK="/local/certik/bld/profile/htvz74mbenv5"
export PATH="${HASHSTACK}/bin":${PATH}
echo "Exporting HASHSTACK=$HASHSTACK"
echo "Adding \${HASHSTACK}/bin to PATH"
echo "Profile py34@htvz74mbenv5 loaded."
# To load the py34@htvz74mbenv5 profile, execute in Bash:
# . <(hit load py34)
certik@redhawk:~$ . <(hit load py34)
Exporting HASHSTACK=/local/certik/bld/profile/htvz74mbenv5
Adding ${HASHSTACK}/bin to PATH
Profile py34@htvz74mbenv5 loaded.
>
> I can test that things work:
>
> certik@redhawk:/tmp/x$ which python
> /home/certik/repos/hashstack/py34/bin/python
> certik@redhawk:/tmp/x$ which ipython
> /home/certik/repos/hashstack/py34/bin/ipython
certik@redhawk:~$ which python
/local/certik/bld/profile/htvz74mbenv5/bin/python
certik@redhawk:~$ which ipython
/local/certik/bld/profile/htvz74mbenv5/bin/ipython
>
> Now I can fire up the notebook and start playing with the code:
>
> certik@redhawk:/tmp/x$ ipython notebook
>
> or executing some scripts like this:
>
> certik@redhawk:/tmp/x$ python eq.py
>
> or run tests like:
>
> certik@redhawk:/tmp/x$ nosetests
>
> or compile my own package, for example csympy, using:
>
> CC=gcc CXX=g++ cmake -DCOMMON_DIR=$HASHSTACK .
>
> You can see that I can just use $HASHSTACK to point to my profile so
> that the cmake can find all the packages it needs. (The CC and CXX
> variables must be explicitly set to use Hashstack's gcc 4.9.2
> compiler.)
>
> But every time I open a new terminal, I have to execute these two lines by hand:
>
> certik@redhawk:/tmp/x$ export HASHSTACK=$HOME/repos/hashstack/py34
> certik@redhawk:/tmp/x$ export PATH=$HASHSTACK/bin:$PATH
Not any more, see above.
>
> And sometimes, when I compile other projects with our own gcc, I also
> need to do:
>
> export LD_LIBRARY_PATH=$HASHSTACK/lib
>
> The reason is that gcc creates an executable and links to its own
> libraries from $HASHSTACK/lib, but it doesn't set rpath by default.
> Sometimes cmake sets rpath to $HASHSTACK/lib, for example for csympy,
> so then things work. But if it's some other project, it usually
> doesn't work, so one either has to set LD_LIBRARY_PATH, which is
> typically what the "module" system does on clusters when you load
> compilers like gcc or Intel, or set rpath by hand in the third party
> project, which typically requires some non-trivial modifications to
> its build system.
LD_LIBRARY_PATH could be also set by the above easily, but it is
actually not necessary even for gcc, we fixed it since then.
>
> Anyway, so now you see the whole motivation. We need some simple way
> to load the "py34" profile, something like this: I open a new
> terminal, go to some directory and do:
>
> $ hit load py34
>
> which will automatically execute:
>
> $ export HASHSTACK=$HOME/repos/hashstack/py34
> $ export PATH=$HASHSTACK/bin:$PATH
>
> or I can do:
>
> $ hit load -l py34
>
> which will execute:
>
> $ export HASHSTACK=$HOME/repos/hashstack/py34
> $ export PATH=$HASHSTACK/bin:$PATH
> $ export LD_LIBRARY_PATH=$HASHSTACK/lib
>
> I think that "-l" should not be the default, as the default should be
> to only add the profile's bin into your PATH and set the $HASHSTACK
> variable, so that you can use it when compiling things by hand.
All fixed.
Fixed.
Done:
certik@redhawk:~$ hit show py34
Information about the py34@htvz74mbenv5 profile:
Path: /local/certik/bld/profile/htvz74mbenv5
Full profile hash: htvz74mbenv5rlrhrrlb2rjybg3ykzzc
List of packages:
berkeleydb-5@ezpn7nogtzm4rt7hdhujxhn3o7nyhlaq
blas@xsvwemqbi4dtutp326zzjpoldt62lqpa
bzip2@yhn7t7sdxdfdkhyie6hg36hqvgccj7rj
cmake@ugrko5ribtzlnijeygdngjxzk774ea6w
cython@6zzo4i57ge2h2m6okivmmwlikqejlly7
docutils@bwc6pilnr3lmkpmm3fwa7kfzqgzosio7
freetype@3j5vs5xri6335xcnnxh7kt3iudaos7lp
gdbm@xqni5hcjx43andearscwqprb54wxnopq
ipython@lgca343h4psoy6deajt4p5plae4mejw3
jinja2@wmepqmliwuqblmzdltzzuss4yu4plvzh
lapack@enbo6mjc6pkeoaoxnykphtro67cnqwqe
launcher@wvmh5uvayzv3bxqk5kirztzn3rckjyv7
line_profiler@4gmcu554pv3pkloryw2k7nbrzrakjq2m
matplotlib@2tcnl243dxoqvm2mzodim7omtpid7j37
mpi@hbd47qrzmwyecvdbonfalbn5xtqurzi3
ncurses@viognkgus4njgat77hcakdedqccl3wjy
nose@nh7kevvepzhzkjivodknnrbdysqiyc4o
numpy@lb3nwf7tc4vwqlcee433yjmjfxrsvhme
openssl@m6pttxckahscjt6jdev5acigozwa6ths
pandas@ouqxw6s77qc4uygkqs5fs2fj3dkcarm2
patchelf@k3rloj265ogtl4dmmmbmyt34dnffryka
pcre@2dpe5reczy3rt2jpx33hs2v675tofarr
perl@xskj3irapqvxclfj5vnb4kgqcygpbpmt
pkg-config@pjksilnbb4iyvrsemnzshe2d3o7uwpa5
png@q24b4y6ojqdwk2nwnblutd4qrjhmlmev
pygments@eppsfejfjdhfyvwusvq6tkqi7x6ro4xc
pyparsing@wfnngy2kxji5dba6jcnpgabf6jpr6dau
python-dateutil@v6trkz2y2v6cbbfu2glzvziaoxg7h4dy
python@5lt333yeqc64s24mir2qrtg5s3llw6ww
pytz@ey3bxm54wpdusoeapi5nyu6aiqiree3p
pyzmq@6ck7aqm5gzvrn357lnwwizxwr2b7j5yk
readline@5tdfuoei3z6ektgh7v7lh3ra36s32ssp
scipy@r2e7sdsky7ubu33glon4fy7qbrvrldty
setuptools@pauvgsufg5xi3fa5cybjtxaptjad2lgs
six@klhtav5h3nv5jrvwjuemhrvenjebz3ba
sphinx@yzkjert2tpkdmnkhuygysqqyqv3wdxiv
sqlite@m5jo67qgu6zfrjydvg3fj3c5zvguflsx
swig@c7uttrdwujdi5rnzxnjoohdr5x6u2aqi
sympy@6vh445eecxwvkyi6rclnt42oksnifkfr
tornado@5a4nt55hfj6i46ifnksxvfhm3zbdpjym
yaml@vxeiq47kjbzo5lcw5bpz4nn4vrfscoet
zlib@3el5ccejre7bcjqgld5gp6iym4ccd5oe
zmq@ezabxw2ecth4wxornymnwdgfkh2d6wi7
>
> Then I want to know which exact version of Python is used, so we need
> something like:
>
> $ hit show python/5lt333yeqc64s24mir2qrtg5s3llw6ww
Done:
certik@redhawk:~$ hit show-package python@5lt333yeqc64s24mir2qrtg5s3llw6ww
Information about the python@5lt333yeqc64 package:
Path: /local/certik/bld/python/5lt333yeqc64
Full package hash: 5lt333yeqc64s24mir2qrtg5s3llw6ww
List of sources:
files:mmrpielmmakqy7nhexzkepv3tgn6g5sm
tar.gz:isr4d3y4psr6j7jfeqvpqdwxfwuucib4
List of dependencies:
bzip2@yhn7t7sdxdfdkhyie6hg36hqvgccj7rj
launcher@wvmh5uvayzv3bxqk5kirztzn3rckjyv7
ncurses@viognkgus4njgat77hcakdedqccl3wjy
openssl@m6pttxckahscjt6jdev5acigozwa6ths
patchelf@k3rloj265ogtl4dmmmbmyt34dnffryka
readline@5tdfuoei3z6ektgh7v7lh3ra36s32ssp
sqlite@m5jo67qgu6zfrjydvg3fj3c5zvguflsx
zlib@3el5ccejre7bcjqgld5gp6iym4ccd5oe
>
> currently I can do by hand:
>
> $ grep "tar.gz" /local/certik/bld/python/5lt333yeqc64/build.json
> "key" : "tar.gz:isr4d3y4psr6j7jfeqvpqdwxfwuucib4",
>
> so at least I can see which tarball was used, so let's look into it:
>
> $ file /local/certik/src/packs/tar.gz/isr4d3y4psr6j7jfeqvpqdwxfwuucib4
> /local/certik/src/packs/tar.gz/isr4d3y4psr6j7jfeqvpqdwxfwuucib4: gzip
> compressed data, from Unix, last modified: Wed Oct 8 02:24:41 2014,
> max compression
>
> Let's figure out which Python version that is:
>
> $ tar tzf /local/certik/src/packs/tar.gz/isr4d3y4psr6j7jfeqvpqdwxfwuucib4
> | head -n1
> Python-3.4.2/
The above shows the source, so one can still do this, but for versions
it's better to add a 'version' field into the yaml files. I've created
a new issue for this:
https://github.com/hashdist/hashdist/issues/327
>
> Ok, so now I know it's Python 3.4.2. All this is obviously cumbersome
> to do by hand, but "hit" should provide nice interface on top of all
> this. It looks like the hit database has lots of information that
> would be very useful for users to start using.
Fixed.
It turns out the the "gc_roots" directory has the name of the
branches, so the above PR uses it. But a proper fix is to include it
in the artifact.json instead.
>
> Just like in git, you can delete branches. It actually doesn't delete
> the commits, only the branch name. You can still recover the commits
> from "git reflog". Eventually they get garbage collected, but that
> takes like 2 weeks or so.
>
> In the same way, I can could do:
>
> hit delete py34
>
> Which just deletes the name "py34" from the 3wikiogtpuvk profile.
> Eventually, if all names are deleted, the profile can eventually get
> garbage collected.
>
>
> Let me know. These are things that are seriously missing and we need a
> robust way to do all the things above.
Most of this is now implemented, now we just need to polish it and
keep improving it.
Ondrej