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: vars:
python_version: 3.9.5 python_version: 3.9.5
tasks: tasks:
- name: install prerequisite packages - name: install system packages
become: yes become: yes
apt: apt:
name: ["build-essential", "wget", "software-properties-common", "libnss3-dev", "zlib1g-dev", name: ["build-essential", "wget", "software-properties-common", "libnss3-dev", "zlib1g-dev",
@ -12,7 +12,7 @@
state: present state: present
update_cache: yes update_cache: yes
- name: download build and install python {{ python_version }} - name: build and install python {{ python_version }}
register: pyinstall register: pyinstall
changed_when: "'NO_COMPILE_NEEDED' not in pyinstall.stdout" changed_when: "'NO_COMPILE_NEEDED' not in pyinstall.stdout"
args: args:
@ -51,41 +51,63 @@
make -j$(nproc) EXTRA_CFLAGS="$CFLAGS" make -j$(nproc) EXTRA_CFLAGS="$CFLAGS"
make EXTRA_CFLAGS="$CFLAGS" install make EXTRA_CFLAGS="$CFLAGS" install
- name: Setup dask directory and venv - name: create dask dir
register: pysetup file:
changed_when: false # lol path: /home/{{ ansible_user }}/dask
args: mode: 0755
executable: "/bin/bash" state: directory
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: 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: file:
path: /home/{{ ansible_user }}/.config/systemd/user path: /home/{{ ansible_user }}/.config/systemd/user
mode: 0755 mode: 0755
state: directory state: directory
- name: Install systemd task - name: install systemd task
template: template:
mode: 0644 mode: 0644
src: templates/leylines-{% if leylines_is_server == "yes" %}scheduler{% else %}worker{% endif %}.service src: templates/leylines-{% if leylines_is_server == "yes" %}scheduler{% else %}worker{% endif %}.service
dest: /home/{{ ansible_user }}/.config/systemd/user 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: systemd:
scope: user scope: user
daemon_reload: true daemon_reload: true