vsoch / scif

scientific filesystem: a filesystem organization for scientific software and metadata
https://sci-f.github.io/
Mozilla Public License 2.0
30 stars 13 forks source link

Testing stream and capture of output #60

Closed vsoch closed 4 years ago

vsoch commented 4 years ago

And fixing bug that we should not run a command if the executable is not found. This pull request can be tested either locally or with a container.

Locally

First remove all installations of scif:

pip uninstall scif

do that command until it tells you it isn't installed. Then clone the branch here:

$ git clone -b test/stream-capture-output https://www.github.com/vsoch/scif
cd scif
python setup.py install

And test as you need!

Container Test

if you want to test with a container, I've pushed the tag 0.0.78-rc to quay.io

docker pull quay.io/scif/scif:0.0.78rc

And you can use this container as a base for your own scif recipe, or any of the tutorials or examples. Signed-off-by: Vanessa Sochat vsochat@stanford.edu

dkp commented 4 years ago

Whoa, you are amazing!
My initial recipes are here (in case it would be useful to take a look): https://bitbucket.org/dpat/scif_fsl/src/master/

So, I tried your branch by adding this to my Dockerfile instead of "RUN pip install scif":

RUN git clone -b test/stream-capture-output https://www.github.com/vsoch/scif
RUN cd scif && python setup.py install

It seemed to do the install, but then freaked out on my scif recipes (which were behaving last night). I'll upload the whole log, but things aren't interesting, I think, until about line 485. scif_experiment_log.txt

vsoch commented 4 years ago

You need to use Python 3.x version - at this point (since Python 2 end of life is ~2 months) you shouldn't be developing with Python 2, really ever.

vsoch commented 4 years ago

I can try using from __future__ import print_function, but I'll still strongly suggest you not use Python 2 :)

vsoch commented 4 years ago

Here is how it works:

Here is your error

$ python2
Python 2.7.15+ (default, Oct  7 2019, 17:39:04) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print("test", end="")
  File "<stdin>", line 1
    print("test", end="")
                     ^
SyntaxError: invalid syntax

Here is the workaround

>>> from __future__ import print_function
>>> print("test", end="\n")
test

Give me a few minutes to update the PR.

vsoch commented 4 years ago

-> https://github.com/vsoch/scif/pull/60/commits/19b6605230a7f637d97633926e066dba8e3932de

dkp commented 4 years ago

Gosh, this is news to me. I install Python3 in the Dockerfile...I guess, since it is based on Ubuntu Trusty, it must be using Python2 by default, even though I installed Python 3? Thanks for identifying that issue. I'll try to make improvements on my end.

vsoch commented 4 years ago

Yes that's exactly true - the "python" executable maps to python 2, and python3 to python 3. Here is a quick example:

$ docker run -it ubuntu:trusty
# Not installed
root@25b7d9b5261e:/# which python
root@25b7d9b5261e:/# apt-get update && apt-get install -y python3 python3-dev
...
# still not installed
root@25b7d9b5261e:/# which python

# installed
root@25b7d9b5261e:/# which python3
/usr/bin/python3

I think when you install python-pip it probably installs python2 as a dependency. You want to do python3-pip instead, if I remember correctly.

dkp commented 4 years ago

I'm with you: apt-get python3-pip RUN pip3 install scif

Now I'll try with your streaming version.

dkp commented 4 years ago

Okay, your streaming version builds now...AND, it is streaming output right to my screen as it runs!! So cool, thank you!

-Dianne

vsoch commented 4 years ago

Awesome! I'm going to merge now (so you could install from master branch) but will wait to release on pypi as 0.0.78 until the conda recipe is merged https://github.com/conda-forge/staged-recipes/pull/9853 that way the release will trigger a conda build.