change to pip module

This commit is contained in:
xenia 2021-06-15 05:44:32 -04:00
parent 5263368a65
commit b81c78a14e
1 changed files with 48 additions and 26 deletions

View File

@ -3,7 +3,7 @@
vars:
python_version: 3.9.5
tasks:
- name: install prerequisite packages
- name: install system packages
become: yes
apt:
name: ["build-essential", "wget", "software-properties-common", "libnss3-dev", "zlib1g-dev",
@ -12,7 +12,7 @@
state: present
update_cache: yes
- name: download build and install python {{ python_version }}
- name: build and install python {{ python_version }}
register: pyinstall
changed_when: "'NO_COMPILE_NEEDED' not in pyinstall.stdout"
args:
@ -51,41 +51,63 @@
make -j$(nproc) EXTRA_CFLAGS="$CFLAGS"
make EXTRA_CFLAGS="$CFLAGS" install
- name: Setup dask directory and venv
register: pysetup
changed_when: false # lol
args:
executable: "/bin/bash"
shell: |
set -eo pipefail
export PATH=$HOME/.local/bin:$PATH
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
if [ ! -d $HOME/dask ]; then
mkdir $HOME/dask
fi
cd $HOME/dask
python3 -m venv dask-venv
. dask-venv/bin/activate
pip3 install --upgrade dask distributed blosc lz4
if [ "{{ leylines_is_server }}" == "no" ]; then
pip3 install --upgrade numpy scipy pandas scikit-image matplotlib opt_einsum cloudpickle fsspec partd psutil sqlalchemy toolz xxhash
else
pip3 install --upgrade bokeh jupyter-server-proxy
fi
- name: create dask dir
file:
path: /home/{{ ansible_user }}/dask
mode: 0755
state: directory
- name: Setup systemd user dir
- name: install python packages
environment:
PATH: '/home/{{ ansible_user }}/.local/bin:{{ ansible_env.PATH }}'
LD_LIBRARY_PATH: '/home/{{ ansible_user }}/.local/lib:{{ ansible_env.get("LD_LIBRARY_PATH", "") }}'
vars:
- base_packages:
- dask
- distributed
- blosc
- lz4
- worker_packages:
- numpy
- scipy
- pandas
- scikit-image
- matplotlib
- opt_einsum
- cloudpickle
- fsspec
- partd
- psutil
- sqlalchemy
- toolz
- xxhash
- scheduler_packages:
- bokeh
- jupyter-server-proxy
- python_packages: "{% if leylines_is_server %}{{ base_packages + scheduler_packages }}{% else %}{{ base_packages + worker_packages }}{% endif %}"
pip:
virtualenv: /home/{{ ansible_user }}/dask/dask-venv
virtualenv_command: python3.9 -m venv
state: latest
name: "{{ python_packages }}"
- name: install systemd user dir
file:
path: /home/{{ ansible_user }}/.config/systemd/user
mode: 0755
state: directory
- name: Install systemd task
- name: install systemd task
template:
mode: 0644
src: templates/leylines-{% if leylines_is_server == "yes" %}scheduler{% else %}worker{% endif %}.service
dest: /home/{{ ansible_user }}/.config/systemd/user
- name: Enable and start systemd task
- name: enable linger
command: loginctl enable-linger
changed_when: false
- name: enable and start systemd task
systemd:
scope: user
daemon_reload: true