Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
c8b212d
huge changes to organization of module
vsoch Jun 19, 2017
310b39a
updates to many files
vsoch Jun 21, 2017
ae005a6
modified: setup.py
vsoch Jun 23, 2017
d605b88
modified: singularity/logger.py
vsoch Jun 23, 2017
2917162
modified: singularity/logger.py
vsoch Jun 23, 2017
09664be
modified: singularity/registry/client.py
vsoch Jun 23, 2017
fa4bdfd
updating singularity registry init
vsoch Jun 26, 2017
ac4739f
modified: singularity/registry/client.py
vsoch Jun 26, 2017
8688d44
adding CI templates to singularity-python
vsoch Jun 26, 2017
3aa29d7
modified: client.py
vsoch Jun 26, 2017
b9593ce
missing errno import
vsoch Jun 26, 2017
87789fd
modified: init.py
vsoch Jun 26, 2017
812c221
need to include registry!
vsoch Jun 26, 2017
abb8027
modified: singularity/registry/init.py
vsoch Jun 26, 2017
3900e4e
updating logger to print newline, client
vsoch Jun 26, 2017
aa935a0
modified: ../logger.py
vsoch Jun 26, 2017
ec0bf54
modified: singularity/package/build.py
vsoch Jun 26, 2017
9071541
modified: singularity/package/build.py
vsoch Jun 26, 2017
cfc0d72
fixing bugs with package module
vsoch Jun 26, 2017
d788a0f
updates to analysis and packages
vsoch Jun 26, 2017
92ce306
modified: singularity/package/build.py
vsoch Jun 26, 2017
8c2a410
more bug fixes
vsoch Jun 26, 2017
ba69eb0
adding build wrapper for registry
vsoch Jun 27, 2017
9c63dfc
modified: registry/client.py
vsoch Jun 27, 2017
308ea12
modified: registry/template.py
vsoch Jun 27, 2017
b45ee98
adding database manager start
vsoch Jun 27, 2017
4d1bf29
modified: singularity/registry/init.py
vsoch Jun 28, 2017
8484bfd
removing config generation from application, will live outside of it
vsoch Jun 29, 2017
94a2692
adding clone function for testing
vsoch Jun 29, 2017
2754e30
modified: ../../../singularity/package/clone.py
vsoch Jun 29, 2017
b14ac17
fixing up clone
vsoch Jun 29, 2017
0eadc09
adding README for package
vsoch Jun 29, 2017
c0bfbbe
updating README
vsoch Jun 29, 2017
51b8776
extra space
vsoch Jun 29, 2017
148a3f7
reorganizing client to have subparsers for better organization
vsoch Jul 1, 2017
195050a
huge reorganization of modules, phew
vsoch Jul 2, 2017
a307435
adding parser for registry folder, and preparing location to launch b…
vsoch Jul 11, 2017
3cc3935
updating cache functions, likely not needed but just in case
vsoch Jul 12, 2017
f10c2f7
bug in sregistry init
vsoch Jul 13, 2017
5d15938
modified: singularity/hub/registry/utils/recipes.py
vsoch Jul 13, 2017
b80637f
modified: singularity/hub/registry/utils/cache.py
vsoch Jul 13, 2017
163e6a1
removing templates for singularity python (added to registry)
vsoch Jul 13, 2017
903778b
removing registry client from shub - too many dependencies
vsoch Jul 14, 2017
5f20033
fixing recipe function
vsoch Jul 18, 2017
0db4a05
need to update get_recipes function
vsoch Jul 21, 2017
4f87dbe
modified: singularity/hub/registry/utils/recipes.py
vsoch Jul 21, 2017
690ab9d
modified: singularity/hub/registry/utils/recipes.py
vsoch Jul 21, 2017
aa4ce9a
modified: singularity/hub/registry/utils/recipes.py
vsoch Jul 21, 2017
fe08d7d
allowing get_recipes to specify a base
vsoch Jul 31, 2017
e0136c8
modified: singularity/hub/registry/utils/recipes.py
vsoch Jul 31, 2017
f432c11
we need to use abspath for the recipe path
vsoch Jul 31, 2017
346e2ad
adding registry functions (start anyway)
vsoch Aug 11, 2017
f9e70ef
fixing up the push command, and a bug in inspect
vsoch Aug 12, 2017
beeb3c0
modified: singularity/cli/__init__.py
vsoch Aug 12, 2017
657a189
modified: singularity/cli/__init__.py
vsoch Aug 12, 2017
71bd596
modified: singularity/cli/__init__.py
vsoch Aug 12, 2017
4fb33b7
adding logging module to have progress bar for registry client
vsoch Aug 14, 2017
6f1ed24
modified: singularity/version.py
vsoch Aug 14, 2017
8af4adc
adding auth bits
vsoch Aug 15, 2017
bc28ede
it's working!
vsoch Aug 15, 2017
dfffd4c
adding client scripts for listing, labels, etc.
vsoch Aug 17, 2017
ab25414
modified: singularity/registry/client/query.py
vsoch Aug 17, 2017
b1fa75e
woot! lots of work!
vsoch Aug 18, 2017
d22460e
modified: examples/registry/run_client.sh
vsoch Aug 18, 2017
1e70300
not using flask currently
vsoch Aug 18, 2017
a507af4
removing unused dependencies
vsoch Aug 18, 2017
922dda4
removing dependencies not needed
vsoch Aug 18, 2017
9072dd8
small tweaks to response to make sure freeze is communicated
vsoch Aug 19, 2017
cbae3d4
modified: singularity/registry/client/delete.py
vsoch Aug 19, 2017
c2f4a0e
addition of size to container upload
vsoch Aug 20, 2017
9d9fd64
adding parsing of "from" line to topic tags for image
vsoch Aug 21, 2017
ededea9
adding image compression to sregistry push
vsoch Aug 21, 2017
3945bbe
adding spinner
vsoch Aug 21, 2017
84a3e62
fixing decompression
vsoch Aug 21, 2017
e20251b
quick update to fix decompression, need to debug a lot more for older…
vsoch Aug 21, 2017
b37bd94
fixing client to read base from file
vsoch Aug 27, 2017
c47282d
removing JSONDecodeError in favor of ValueError
vsoch Aug 27, 2017
5df4bed
changing order of obtaining "from" statement
vsoch Aug 27, 2017
e10ba78
changing to -6 compression, feedback wanted
vsoch Aug 27, 2017
2232fb6
modified: singularity/version.py
vsoch Sep 13, 2017
b9aff26
updating builder scripts for testing
vsoch Sep 30, 2017
75754b8
new file: singularity/build/scripts/singularity-build-2.3.sh
vsoch Sep 30, 2017
f151cdf
Merge branch 'development' of github.com:vsoch/singularity-python int…
vsoch Sep 30, 2017
7db8ccf
preparing builder for shub v.2.0
vsoch Sep 30, 2017
3dac25f
modified: singularity/build/main.py
vsoch Sep 30, 2017
144c4f9
removing converter for dockerfile
vsoch Oct 3, 2017
05ca01d
modified: singularity/build/google.py
vsoch Oct 3, 2017
92b6c2e
updating builder to test
vsoch Oct 5, 2017
01550de
modified: singularity/build/google.py
vsoch Oct 5, 2017
c6b48fd
modified: singularity/build/google.py
vsoch Oct 5, 2017
97dabf6
modified: singularity/package/build.py
vsoch Oct 5, 2017
82d21b8
modified: singularity/build/main.py
vsoch Oct 5, 2017
e37fc2a
adding apps
vsoch Oct 5, 2017
ad84875
modified: singularity/analysis/apps.py
vsoch Oct 5, 2017
f6eeae5
modified: singularity/build/google.py
vsoch Oct 5, 2017
282600f
modified: singularity/build/google.py
vsoch Oct 5, 2017
5494f8a
don't upload image package
vsoch Oct 5, 2017
5ac1e3f
modified: singularity/analysis/compare.py
vsoch Oct 6, 2017
a8cfea8
adding compression back to image
vsoch Oct 6, 2017
01b7506
updating builder script to use development singularity-python
vsoch Oct 9, 2017
572a4b9
lots of changes for builder
vsoch Oct 10, 2017
e2c27ed
fixing bug with client - inspect doesn't take args
vsoch Oct 10, 2017
ecb391f
adding more details to pull for debug
vsoch Oct 10, 2017
1cae63a
adding more debug to push
vsoch Oct 10, 2017
a5ad68e
modified: singularity/build/main.py
vsoch Oct 10, 2017
70fb9a1
modified: singularity/build/google.py
vsoch Oct 11, 2017
782f436
modified: singularity/analysis/apps.py
vsoch Oct 12, 2017
7ba65e9
updating build
vsoch Oct 12, 2017
752643f
modified: singularity/analysis/apps.py
vsoch Oct 12, 2017
7b54079
adding two hour timeout
vsoch Oct 13, 2017
ed3cab6
modified: singularity/build/scripts/singularity-build-latest.sh
vsoch Oct 14, 2017
05954b8
modified: singularity/build/scripts/singularity-build-latest.sh
vsoch Oct 14, 2017
7b0e9ed
path in storage needs to use hash
vsoch Oct 14, 2017
5a9c3d9
adding different build options / templates
vsoch Oct 14, 2017
7c80b85
starting to fix some bugs/updates for release
vsoch Oct 15, 2017
b7af47d
updating script to add runscript
vsoch Oct 15, 2017
2de15f4
adding create
vsoch Oct 15, 2017
bb249b3
updating client examples, etc
vsoch Oct 15, 2017
2e93065
bug in shub client
vsoch Oct 16, 2017
635c9c0
fixing bug with date parsing, thanks @victorsndvg
vsoch Oct 16, 2017
d4e5778
fixing bug with finish build (no version if image failed to bulid)
vsoch Oct 16, 2017
3c3d4f6
Update run_client.sh
victorsndvg Oct 17, 2017
a4d19c6
Merge pull request #3 from victorsndvg/patch-1
vsoch Oct 17, 2017
b2f718e
updating call to check if data None
vsoch Oct 17, 2017
c46d095
Merge branch 'development' of github.com:vsoch/singularity-python int…
vsoch Oct 17, 2017
18c49b7
updating timestamp function to specify timezone utc
vsoch Oct 17, 2017
427e44f
pip3 --> pip3.5
vsoch Oct 18, 2017
6ef6d33
updating with new test grid
vsoch Oct 19, 2017
61d74d3
modified: .travis.yml
vsoch Oct 19, 2017
28bd236
missing dependencies
vsoch Oct 19, 2017
4b2527a
modified: .travis/script
vsoch Oct 19, 2017
058c24b
updating tests for client to not repull images
vsoch Oct 19, 2017
ce6e55e
fixing up early tests
vsoch Oct 19, 2017
753d8d9
modified: singularity/cli/__init__.py
vsoch Oct 19, 2017
6a1fde2
changing export
vsoch Oct 19, 2017
4a47bdb
modified: cli/__init__.py
vsoch Oct 19, 2017
1fe67b7
fixing up utils tests
vsoch Oct 19, 2017
c1da73e
more tweaks to tests, lots of work still
vsoch Oct 19, 2017
289de49
updating comparison tests
vsoch Oct 20, 2017
3d9f0b2
updating tests
vsoch Oct 20, 2017
38124d3
modified: singularity/cli/__init__.py
vsoch Oct 20, 2017
569fcf7
fixing pull/path issue
vsoch Oct 20, 2017
a8a3ae9
modified: singularity/build/scripts/singularity-build-latest.sh
vsoch Oct 20, 2017
b5d1e4d
adding headers to debug testing
vsoch Oct 20, 2017
a0e3908
more updates
vsoch Oct 20, 2017
89b4beb
modified: test_analysis_compare.py
vsoch Oct 20, 2017
df7d3f9
modified: tests/test_build_utils.py
vsoch Oct 20, 2017
4e7ede8
modified: tests/test_package.py
vsoch Oct 20, 2017
bb13e1e
modified: analysis/reproduce/utils.py
vsoch Oct 21, 2017
8a142e1
modified: ../requirements.txt
vsoch Oct 21, 2017
4820e3d
modified: analysis/reproduce/utils.py
vsoch Oct 21, 2017
ad269bf
tweaks to build
vsoch Oct 21, 2017
da730ce
missing strip
vsoch Oct 21, 2017
1469f30
removing latest
vsoch Oct 21, 2017
aad4c8b
modified: singularity/tests/test_client.py
vsoch Oct 21, 2017
55b9057
modified: singularity/cli/__init__.py
vsoch Oct 21, 2017
abcbda4
modified: singularity/analysis/reproduce/hash.py
vsoch Oct 21, 2017
fc268d1
updating to not use memory tar
vsoch Oct 21, 2017
8b0238d
modified: singularity/cli/main/__init__.py
vsoch Oct 21, 2017
9d4203a
modified: singularity/cli/main/__init__.py
vsoch Oct 21, 2017
067169d
updating packages
vsoch Oct 21, 2017
0d42bdb
modified: README.md
vsoch Oct 21, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
singularity.egg-info
__pycache__
pypi.sh
dist
*.pyc
OLD
25 changes: 11 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ sudo: true
os: linux

language: python
python:
- "2.7"
- "3.5"

install:
- pip install pylint
- cd $TRAVIS_BUILD_DIR/
- cd $TRAVIS_BUILD_DIR && pip install -r requirements.txt
- cd $TRAVIS_BUILD_DIR && pip3 install -r requirements.txt
- python setup.py sdist
- python setup.py install
- pylint --version
- cd /tmp && git clone -b development https://github.com/singularityware/singularity.git && cd singularity && ./autogen.sh && ./configure --prefix=/usr/local && make && sudo make install
matrix:
include:
- os: linux
env: PYTHON_VERSION=2
- os: linux
env: PYTHON_VERSION=3

before_install:
- sudo chmod u+x .travis/*
- .travis/before_install

script:
- python -m unittest discover -s $TRAVIS_BUILD_DIR/singularity/tests/ -p '[t|T]est*.py'
#bash $TRAVIS_BUILD_DIR/singularity/tests/run_tests.sh $TRAVIS_BUILD_DIR/singularity/tests /tmp
- .travis/script
36 changes: 36 additions & 0 deletions .travis/before_install
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

apt-get update && apt-get install -y wget git build-essential squashfs-tools \
libtool \
autotools-dev \
automake \
autoconf

sudo sed -i -e 's/^Defaults\tsecure_path.*$//' /etc/sudoers

if [ "${PYTHON_VERSION}" == "2" ];
then
wget https://repo.continuum.io/archive/Anaconda2-5.0.0.1-Linux-x86_64.sh
sudo bash Anaconda2-5.0.0.1-Linux-x86_64.sh -b -p /opt/anaconda2 && sudo chown -R 0755 /opt/anaconda2
PATH=/opt/anaconda3/bin:$PATH
rm Anaconda2-5.0.0.1-Linux-x86_64.sh
export PATH
else
wget https://repo.continuum.io/archive/Anaconda3-5.0.0.1-Linux-x86_64.sh
sudo bash Anaconda3-5.0.0.1-Linux-x86_64.sh -b -p /opt/anaconda3 && sudo chown -R 0755 /opt/anaconda3
PATH=/opt/anaconda3/bin:$PATH
rm Anaconda3-5.0.0.1-Linux-x86_64.sh
export PATH
fi

# Install python dependencies
which python

conda install -y pandas scikit-learn pygments
cd $TRAVIS_BUILD_DIR && sudo python -m pip install -r requirements.txt
python setup.py sdist && python setup.py install
pylint --version

# Install Singularity (development)
cd /tmp && git clone -b development https://github.com/singularityware/singularity.git && cd singularity && ./autogen.sh && ./configure --prefix=/usr/local && make && sudo make install

3 changes: 3 additions & 0 deletions .travis/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
sudo apt-get install -y squashfs-tools
python -m unittest discover -s $TRAVIS_BUILD_DIR/singularity/tests/ -p '[t|T]est*.py'
15 changes: 5 additions & 10 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
include README.md
include LICENSE
recursive-include singularity/tests *
recursive-include singularity/hub *
recursive-include singularity/templates *
recursive-include singularity/static *
recursive-include singularity/build *
recursive-include singularity/analysis *
recursive-include singularity/views *
recursive-include singularity/testing *
include README.md LICENSE
recursive-include singularity *
recursive-exclude * __pycache__
recursive-exclude * *.pyc
recursive-exclude * *.pyo
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# Singularity Python

[![Build Status](https://travis-ci.org/singularityware/singularity-python.svg?branch=master)](https://travis-ci.org/singularityware/singularity-python)
Expand All @@ -12,4 +10,3 @@ Please see our [complete docs](https://github.com/singularityware/singularity-py

## Help and Contribution
Please contribute to the package, or post feedback and questions as <a href="https://github.com/singularityware/singularity-python" target="_blank">issues</a>. For points that require discussion of the larger group, please use the <a href="https://groups.google.com/a/lbl.gov/forum/#!forum/singularity" target="_blank">Singularity List</a>

48 changes: 29 additions & 19 deletions examples/cli/run_singularity/singularity_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,46 @@
S.help()

# These are the defaults, which can be specified
S = Singularity(sudo=False,sudopw=None,debug=False)
S = Singularity(sudo=False,debug=False)

# Create an image
image = S.create('myimage.img')
# Note that the "create" and "import" workflow is deprecated in favor of build
# https://singularityware.github.io/docs-build

# Import into it
image = S.build('myimage.simg', 'docker://ubuntu:latest') # requires sudo

# (Deprecated) create an image and import into it
image = S.create('myimage.simg')
S.importcmd(image,'docker://ubuntu:latest')

# Execute command to container
result = S.execute(image,command='cat /singularity')
print(result)
'''
#!/bin/sh

if test -x /bin/bash; then
exec /bin/bash "$@"
elif test -x /bin/sh; then
exec /bin/sh "$@"
else
echo "ERROR: No valid shell within container"
exit 255
fi
'#!/bin/sh\n\nexec "/bin/bash"\n'
'''

# For any function you can get the docs:
S.help(command="exec")

# export an image as a byte array
byte_array = S.export(image)
# export an image to tar
tar = S.export(image)

# Show apps and inspect
S.apps(image)
S.inspect(image)

# Get an in memory tar
from singularity.reproduce import get_memory_tar
tar = get_memory_tar(image)
'''
{
"data": {
"attributes": {
"deffile": null,
"help": null,
"labels": null,
"environment": "# Custom environment shell code should follow\n\n",
"runscript": "#!/bin/sh\n\nexec \"/bin/bash\"\n",
"test": null
},
"type": "container"
}
}
'''
41 changes: 37 additions & 4 deletions examples/create/make_runscript/make_runscript.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
#!/bin/sh

# Generate a python run script in the present working directory
shub --runscript py
# See help
shub create --help

# Generate a python run script somewhere else
shub --runscript py --outfolder /home/vanessa/Desktop
'''
Usage: shub create [-h] [--recipe] [--app APP] [--from BOOTSTRAP_FROM]
[--bootstrap BOOTSTRAP] [--outfolder OUTFOLDER]

optional arguments:
-h, --help show this help message and exit
--recipe create template recipe
--app APP the name of an app to include in the recipe
--from BOOTSTRAP_FROM
the bootstrap "from", should coincide with "bootstrap"
type
--bootstrap BOOTSTRAP
the bootstrap type, default is docker
--outfolder OUTFOLDER
full path to folder for output, stays in tmp (or pwd)
if not specified

'''

# Generate a relatively blank template, default bootstrap is docker
shub create
'''
DEBUG bootstrap: docker
Output file written to /home/vanessa/Documents/Dropbox/Code/singularity/singularity-python/examples/create/make_runscript/Singularity
'''

# Create a recipe template for an app
shub create --app foo
'''
DEBUG bootstrap: docker
Output file written to /home/vanessa/Documents/Dropbox/Code/singularity/singularity-python/examples/create/make_runscript/Singularity.foo
'''

# Specify a from, bootstrap
shub create --app foo --from ubuntu --bootstrap docker
53 changes: 0 additions & 53 deletions examples/create/make_runscript/singularity

This file was deleted.

7 changes: 1 addition & 6 deletions examples/create/package_image/package_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,4 @@
if not os.path.exists(package_name):
image_package = package(image_path=image,
output_folder=output_folder,
remove_image=True,
runscript=True,
software=True)
tmpfolder = os.path.dirname(image)
shutil.rmtree(tmpfolder)

old_version=True) # makes file tar instead of memory
76 changes: 76 additions & 0 deletions examples/create/package_node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Package a Node

This is a test for functions that will package a node, meaning sitting on it, and then having it packaged and built into a singularity image (on a host with Singularity). This is only relevant for `vsoch/singularity-python` development branch.

## Install Development Singularity Python
```
git clone -b development https://www.github.com/vsoch/singularity-python
cd singularity-python
python3 setup.py sdist
python3 setup.py install
```

## Package Node
Then in python3 (this is what the builder on Singularity Hub uses, so I am using that image to test)

```
from singularity.package import package_node

package=package_node()

package
'/tmp/tmp06ww_8_n/vanessa-testing-self-cloning.tgz'
```

## Unpack Node into Container
Then this file can be turned into a Singularity image:

```
from singularity.package import unpack_node
image = unpack_node(image_path=package,size=9000)
```

We see unpack, image creation, and a break at the end when it's importing:

```
DEBUG Preparing to unpack vanessa-testing-self-cloning.tgz to vanessa-testing-self-cloning.img.
Initializing Singularity image subsystem
Opening image file: vanessa-testing-self-cloning.img
Creating 2000MiB image
Binding image to loop
Creating file system within image
Image is done: /vanessa-testing-self-cloning.img
```

The image is named the same as the original `.tgz` but with an `img` extension if `name` is not specified, and in the same folder as the host if `output_folder` is not specified.

```
image
$ '/home/vanessa/Desktop/vanessa-testing-self-cloning.img'

```

## Testing Image
Then on the host, there isn't a run driver so we can't run:

```
./vanessa-testing-self-cloning.img
ERROR : No run driver found inside container
ABORT : Retval = 255
```

But we can shell!

```
$ sudo singularity shell vanessa-testing-self-cloning.
Singularity: Invoking an interactive shell within container..
#
ls /
# ls /
bin home lib64 opt sbin tmp vmlinuz.old
boot initrd.img lost+found proc snap usr
dev initrd.img.old media root srv var
etc lib mnt run sys vmlinuz
```

Proposal: we would want to have security checks, and then generation of the needed commands (possibly via bootstrap functions) that would be needed to drive the image.
Loading