Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build conda package and upload to anaconda #515

Merged
merged 80 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
8023e9a
add a file to build wheel
Aristoeu Feb 9, 2024
ae467cb
build wheel action
Aristoeu Feb 16, 2024
4c5d5a4
build wheel only for py3.8
Aristoeu Feb 16, 2024
4be984f
restore unnecessary changes
Aristoeu Feb 16, 2024
d5b80f9
conda build and upload in workflow
Aristoeu Feb 16, 2024
abd5243
wheel location changed
Aristoeu Feb 16, 2024
c35d455
source location in meta.yaml
Aristoeu Feb 16, 2024
8e646fd
add cibuildwheel and change openblas option
Aristoeu Feb 16, 2024
7645830
conda build
Aristoeu Feb 23, 2024
a41470e
conda build workflow
Aristoeu Feb 23, 2024
5d166a2
install conda-build
Aristoeu Feb 23, 2024
e8e79a7
test pip
Aristoeu Feb 23, 2024
0885a27
d
Aristoeu Feb 23, 2024
0931996
upload
Aristoeu Feb 23, 2024
1556f4c
conda path
Aristoeu Feb 23, 2024
c4bb566
build upload
Aristoeu Feb 23, 2024
a1e6d35
addd &&
Aristoeu Feb 23, 2024
04c525b
rename step name
Aristoeu Feb 23, 2024
e91ccef
add multiple py versions
Aristoeu Feb 28, 2024
f1c9ee1
correct format
Aristoeu Feb 28, 2024
1ad0061
change py version to string
Aristoeu Feb 28, 2024
ae2880c
restore
Aristoeu Feb 29, 2024
cfb56d8
refactor
Aristoeu Feb 29, 2024
8135a08
py versions add
Aristoeu Mar 1, 2024
a1f1704
Jinja2 py version
Aristoeu Mar 1, 2024
b554f2e
export py version
Aristoeu Mar 1, 2024
7e69287
add tag
Aristoeu Mar 1, 2024
cd5308a
matrix and force upload
Aristoeu Mar 1, 2024
acf0d55
add obspy
Aristoeu Mar 1, 2024
ed935ed
add cpp build
Aristoeu Mar 1, 2024
da8586b
add gsl
Aristoeu Mar 1, 2024
308ce54
add boost
Aristoeu Mar 1, 2024
b44ece1
libboost
Aristoeu Mar 1, 2024
4d61e63
add main label
Aristoeu Mar 1, 2024
56dfb43
Merge pull request #518 from mspass-team/conda_action
Aristoeu Mar 1, 2024
3b7a7bc
add py 3.12
Aristoeu Mar 1, 2024
bc92549
arm build
Aristoeu Mar 8, 2024
81e26a6
micromamba
Aristoeu Mar 8, 2024
1c3bc1f
new env
Aristoeu Mar 8, 2024
aa010f0
anaconda
Aristoeu Mar 8, 2024
3521211
change
Aristoeu Mar 8, 2024
949ad74
copy
Aristoeu Mar 8, 2024
b955d9a
add pkg
Aristoeu Mar 15, 2024
a4ea1eb
make work
Aristoeu Mar 15, 2024
cdf244c
add cmake
Aristoeu Mar 15, 2024
96fc903
Merge pull request #525 from mspass-team/conda-testing
Aristoeu Mar 22, 2024
920e355
Merge branch 'master' into build-to-wheel-for-conda
Aristoeu Mar 22, 2024
6718392
add doc for conda and coiled
Aristoeu Mar 22, 2024
eea554b
Update deploy_mspass_with_conda_and_coiled.rst
pavlis Mar 29, 2024
fe419e6
update doc add connect to mongoatlas
Aristoeu Apr 5, 2024
f5a2709
add cartopy
Aristoeu May 10, 2024
ffbd507
try old version cmake=3.10
Aristoeu May 10, 2024
610817e
camke 3.13
Aristoeu May 10, 2024
12b202a
cmake version
Aristoeu May 10, 2024
2c25941
use an old base container
Aristoeu May 10, 2024
152f0bb
no update
Aristoeu May 11, 2024
524d3d9
mannual download cmake 3.13
Aristoeu May 11, 2024
8667ade
gdebi-core
Aristoeu May 11, 2024
044a5f8
older base container
Aristoeu May 11, 2024
a8d3ef1
change to miniconda
Aristoeu May 11, 2024
ce9b457
install conda mannually
Aristoeu May 13, 2024
6b237b9
conda clean fix
Aristoeu May 13, 2024
d4f5920
Merge branch 'master' into build-to-wheel-for-conda
Aristoeu May 13, 2024
1156b8e
install cmake
Aristoeu May 13, 2024
dc075e8
Merge branch 'build-to-wheel-for-conda' of https://github.com/mspass-…
Aristoeu May 13, 2024
66189f1
debug build conda
Aristoeu May 13, 2024
4f2dcd5
change workdir, add py version
Aristoeu May 14, 2024
dbaa0f5
push to mspass org
wangyinz May 14, 2024
fca833b
remove MANIFEST.in; use version from project; reduce pkg size
wangyinz May 14, 2024
ff9e352
use build script to prep source
wangyinz May 14, 2024
0d67173
go back to use exclude files
wangyinz May 14, 2024
7399ca7
add build script
wangyinz May 14, 2024
67783af
fix problem finding version number
wangyinz May 14, 2024
8624f79
try removing files from source
wangyinz May 14, 2024
1c226e4
remove recipe from dist
wangyinz May 14, 2024
6576e7a
fix wrong build script;remove pandas version
wangyinz May 15, 2024
13f9de1
change doc to mspass
wangyinz May 15, 2024
c6b7216
standardize versioning
wangyinz May 15, 2024
b3d9914
add git into container for version
wangyinz May 15, 2024
84e2314
remove .git from container at the end
wangyinz May 15, 2024
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
61 changes: 61 additions & 0 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: publish_conda

on:
push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]

jobs:
conda-build-arm:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout repository
uses: actions/checkout@v3

# Setup for Multi-platform image
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push Docker image arm64
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile_arm_conda
platforms: linux/arm64
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
ANACONDA_API_TOKEN=${{ secrets.CONDA_TOKEN }}

conda-build-amd64:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: s-weigand/setup-conda@v1
- run: |
export PYTHON_VERSION=${{ matrix.python-version }}
conda install conda-build anaconda-client
conda config --set anaconda_upload no
conda config --add channels conda-forge
export ANACONDA_API_TOKEN=${{ secrets.CONDA_TOKEN }}
PACKAGE_PATH=$(conda build . --python ${{ matrix.python-version }} --output)
conda build . --python ${{ matrix.python-version }}
if [ "${{ matrix.python-version }}" == "3.11" ]; then
anaconda -t $ANACONDA_API_TOKEN upload $PACKAGE_PATH --label main --label py3.11 --force
else
anaconda -t $ANACONDA_API_TOKEN upload $PACKAGE_PATH --label py${{ matrix.python-version }} --force
fi

1 change: 1 addition & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ jobs:
BRANCH: gh-pages
FOLDER: docs/build/html
CLEAN: false

3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ ADD setup.py /mspass/setup.py
ADD pyproject.toml /mspass/pyproject.toml
ADD requirements.txt /mspass/requirements.txt
ADD python /mspass/python
ADD .git /mspass/.git
RUN pip3 install /mspass -v \
&& rm -rf /mspass/build && docker-clean
&& rm -rf /mspass/build /mspass/.git && docker-clean

# Install jedi
RUN pip3 --no-cache-dir install jedi==0.17.2 && docker-clean
Expand Down
33 changes: 33 additions & 0 deletions Dockerfile_arm_conda
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM --platform=linux/arm64/v8 ubuntu:22.04
COPY . /mspass
RUN mv /mspass /mspasspy_build
WORKDIR /mspasspy_build
RUN ls
RUN pwd
ARG PYTHON_VERSION
ENV PATH /opt/conda/bin:$PATH
RUN apt-get update --fix-missing && \
apt-get install -y wget bzip2 ca-certificates curl git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda clean -a -y && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc

ARG ANACONDA_API_TOKEN

RUN apt-get update && apt-get install -y cmake
RUN cd /mspasspy_build && sed -i '38d' meta.yaml \
&& conda install -y conda-build anaconda-client \
&& conda config --set anaconda_upload no \
&& conda config --add channels conda-forge \
&& export CONDA_BUILD_DEBUG=1 \
&& PACKAGE_PATH=$(conda build . --python ${PYTHON_VERSION} --output) \
&& conda build . --python ${PYTHON_VERSION} --debug \
&& anaconda -t $ANACONDA_API_TOKEN upload $PACKAGE_PATH --label py${PYTHON_VERSION} --force

3 changes: 2 additions & 1 deletion Dockerfile_dev
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ ADD setup.py /mspass/setup.py
ADD python /mspass/python
ADD pyproject.toml /mspass/pyproject.toml
ADD requirements.txt /mspass/requirements.txt
ADD .git /mspass/.git
RUN pip3 install -C--global-option=build -C--global-option=--debug /mspass -v \
&& rm -rf /mspass/build && docker-clean
&& rm -rf /mspass/build /mspass/.git && docker-clean

# Add docs and dependencies to build docs
ADD docs /mspass/docs
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile_mpi
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ ADD setup.py /mspass/setup.py
ADD python /mspass/python
ADD pyproject.toml /mspass/pyproject.toml
ADD requirements.txt /mspass/requirements.txt
ADD .git /mspass/.git
RUN pip3 install /mspass -v \
&& rm -rf /mspass/build && docker-clean
&& rm -rf /mspass/build /mspass/.git && docker-clean

# Install jedi
RUN pip3 --no-cache-dir install jedi==0.17.2 && docker-clean
Expand Down
6 changes: 3 additions & 3 deletions cxx/cmake/openblas-download.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ ExternalProject_Add(
openblas
SOURCE_DIR "@OPENBLAS_DOWNLOAD_ROOT@/openblas-src"
GIT_REPOSITORY
https://github.com/xianyi/OpenBLAS.git
https://github.com/OpenMathLib/OpenBLAS.git
GIT_TAG
v0.3.7
v0.3.27
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND make libs -j 8 PREFIX=${PROJECT_BINARY_DIR} NO_SHARED=1 USE_THREAD=0 USE_OPENMP=0
BUILD_COMMAND make libs -j 8 PREFIX=${PROJECT_BINARY_DIR} NO_SHARED=1 USE_THREAD=0 USE_OPENMP=0 DYNAMIC_ARCH=1 DYNAMIC_OLDER=1 TARGET=GENERIC
BUILD_IN_SOURCE 1
INSTALL_COMMAND make install PREFIX=${PROJECT_BINARY_DIR} NO_SHARED=1
TEST_COMMAND ""
Expand Down
145 changes: 145 additions & 0 deletions docs/source/getting_started/deploy_mspass_with_conda_and_coiled.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
.. _deploy_mspass_with_conda_and_coiled:

Deploy MsPASS with Conda and Coiled
===============================

Overview
-------------
This section provides a concise summary of the steps required to run
MsPASS using Conda and Coiled. The instructions assume you are working
in a cloud environment (AWS, GCP, Azure). You can also only use conda
to install MsPASS locally without Coiled (step 3).

1. Install Coiled
---------------------
Fetch and install Coiled following instructions on the
`Coiled web site <https://docs.coiled.io/user_guide/setup/index.html>`__.

Install the Coiled client Python library with pip or conda.

.. code-block::

pip install coiled "dask[complete]"
coiled login

This will redirect you to the Coiled website to authenticate your computer.


2. Connect to your cloud
---------------------------------------------
Next grant Coiled permission to run in your cloud account(AWS, GCP, Azure).
Coiled creates the IAM policies and network configuration for your account,
asking you for permission at each step.

.. code-block::

coiled setup aws
coiled setup gcp

You can configure Coiled with custom network configuration in the
`user portal <https://cloud.coiled.io/settings/setup/infrastructure>`__.

3. Get MsPASS Conda package
-------------------------------------------
If you have not run MsPASS before you will need to get the
`conda package <https://anaconda.org/mspass/mspasspy>`__.
from our standard repository. Alternatively if you want to get the most
recent updates you may also need to do this step.

We strongly advise you create a separate environment for mspass
to avoiding breaking any existing python packages you may have
installed previous. Make sure you are on the `base` environment
ant enter

.. code-block::

conda create --name mspass

Noting the name "mspass" is not special and it can be changed if you
prefer something else. You chould then make the new
environment current with the standand conda command:

.. code-block::

conda activate mspass

You will almost certainly need to add key "channels" as follows:

.. code-block::

conda config --add channels mspass
conda config --add channels conda-forge

Then install mspass in this environment with

.. code-block::

conda install -y mspasspy

4. Run MsPASS
-------------------------
After installing, Coiled will then pick up all those things installed locally,
and install them on your cluster. For running things on Coiled, you could
try `coiled run your_code.py` (or follow one of the examples in
`coiled docs <https://docs.coiled.io/user_guide/usage/examples.html>`__)!


For example, to connect to MongoDB using Atlas:

.. code-block::

from pymongo.mongo_client import MongoClient
from pymongo.server_api import ServerApi
from urllib.parse import quote_plus
username = "your username"
password = "your password"

# URL-encode the username and password
uri_username = quote_plus(username)
uri_password = quote_plus(password)
uri = "mongodb+srv://username:[email protected]/"

# Create a new client and connect to the server
client = MongoClient(uri, server_api=ServerApi('1'))

# Send a ping to confirm a successful connection
try:
client.admin.command('ping')
print("Pinged your deployment. You successfully connected to MongoDB!")
except Exception as e:
print(e)

If the ping success, it means we successfully connect to your remote mongo database.
Let's build a MsPASS client and start to use MsPASS:

.. code-block::

from mspasspy.db.client import DBClient
dbclient=DBClient(uri)
dbclient.list_database_names() # view all the databases
db = dbclient['mspass'] # choose a database
db.index_mseed_file('CIGSC__BHZ___2017180.ms', some_path) # index mseed files


To use Dask:

.. code-block::

from coiled import Cluster

cluster = Cluster(n_workers=20)
client = cluster.get_client()

Once you have a Dask cluster you can then run Python code on that cluster.
Here is a simple code you could run:

.. code-block::

def inc(x):
return x + 1

future = client.submit(inc, 10)
future.result() # returns 11

You can find more useful examples in Coiled documentation and reach out to
Coiled team ([email protected]) for any usage questions.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ package.
getting_started/deploy_mspass_with_docker_compose
getting_started/deploy_mspass_on_HPC
getting_started/getting_started_overview
getting_started/deploy_mspass_with_conda_and_coiled

.. toctree::
:maxdepth: 1
Expand Down
85 changes: 85 additions & 0 deletions meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#{% set version_match = load_file_regex(load_file='pyproject.toml', regex_pattern='version = "(.*)"') %}
#{% set version = version_match[1] %}

package:
name: mspasspy
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
# version: {{ version }}

source:
path: .

build:
script: scripts/conda_build.sh
include_recipe: False
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
string: {{ environ.get('GIT_BUILD_STR', '') }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('gfortran') }}
- gsl


host:
- python {{ PYTHON_VERSION }}
- pip
- gsl
- ipympl
- boost
- boost-cpp
- lapack
- libblas
- yaml-cpp

run:
- python {{ PYTHON_VERSION }}
- boost
- libboost-devel
- libzlib
- gsl
- pyyaml
- yaml-cpp
- libblas
- pymongo
- numpy
- obspy
- dill
- click
- cartopy
- dask
- distributed
- cloudpickle
- schema
- decorator
- boto3
- botocore
- moto
- requests
- setuptools
- xarray
- zarr
- pandas
- numba
- multitaper
- ipympl


about:
home: https://github.com/mspass-team/mspass
license: BSD 3-Clause
license_file: LICENSE
license_family: BSD
license_url: https://github.com/mspass-team/mspass/blob/master/LICENSE
summary: Massive Parallel Analysis System for Seismologists
description: |
The Massive Parallel Analysis System for Seismologists is an open source framework
for seismic data processing and management. It has three core components.
A scalable parallel processing framework based on a dataflow computation model.
A NoSQL database system centered on document store.
A container-based virtualization environment.
dev_url: https://github.com/mspass-team/mspass
doc_url: https://www.mspass.org
doc_source_url: https://github.com/mspass-team/mspass/blob/master/docs/source/index.rst
Loading
Loading