Skip to content
Snippets Groups Projects
Commit fbb412bd authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Merge branch 'v0.1' into 'master'

Initial version of the base worker, with cookiecutter support

Closes #1

See merge request arkindex/base-worker!1
parents fde4b49f 2b99c7e5
No related branches found
No related tags found
1 merge request!1Initial version of the base worker, with cookiecutter support
Pipeline #77838 failed
[settings]
# Compatible with black
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
line_length = 88
default_section=FIRSTPARTY
known_first_party =
known_third_party = arkindex_worker
repos:
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
additional_dependencies:
- 'flake8-coding==1.3.1'
- 'flake8-copyright==0.2.2'
- 'flake8-debugger==3.1.0'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
- id: check-ast
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- id: trailing-whitespace
- id: check-yaml
args: [--allow-multiple-documents]
- id: mixed-line-ending
- id: name-tests-test
args: ['--django']
- id: check-json
- id: requirements-txt-fixer
- repo: https://github.com/codespell-project/codespell
rev: v1.17.1
hooks:
- id: codespell
args: ['--write-changes']
- repo: meta
hooks:
- id: check-useless-excludes
default_language_version:
python: python3.7
FROM python:3
WORKDIR /usr/share/teklia/{{ cookiecutter.slug }}
ADD worker.py .
ADD requirements.txt .
RUN pip install -r requirements.txt
CMD ["python", "worker.py"]
#!/bin/sh -e
# Build the tasks Docker image.
# Requires CI_PROJECT_DIR and CI_REGISTRY_IMAGE to be set.
# VERSION defaults to latest.
# Will automatically login to a registry if CI_REGISTRY, CI_REGISTRY_USER and CI_REGISTRY_PASSWORD are set.
# Will only push an image if $CI_REGISTRY is set.
if [ -z "$VERSION" ]; then
VERSION=${CI_COMMIT_TAG:-latest}
fi
if [ -z "$VERSION" -o -z "$CI_PROJECT_DIR" -o -z "$CI_REGISTRY_IMAGE" ]; then
echo Missing environment variables
exit 1
fi
if [ -n "$CI_REGISTRY" -a -n "$CI_REGISTRY_USER" -a -n "$CI_REGISTRY_PASSWORD" ]; then
echo Logging in to container registry…
echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
fi
IMAGE_TAG="$CI_REGISTRY_IMAGE:$VERSION"
cd $CI_PROJECT_DIR
docker build -f Dockerfile . -t "$IMAGE_TAG"
if [ -n "$CI_REGISTRY" ]; then
docker push "$IMAGE_TAG"
fi
arkindex-base-worker==0.1.0
# -*- coding: utf-8 -*-
def test_dummy():
assert True
[tox]
envlist = worker-{{ cookiecutter.slug }}
skipsdist=True
[testenv]
commands =
pytest
deps =
pytest
-rrequirements.txt
# -*- coding: utf-8 -*-
from arkindex_worker.worker import BaseWorker
class Demo(BaseWorker):
def process_element(self, element):
print("Demo processing element", element)
if __name__ == "__main__":
Demo(description="{{ cookiecutter.name }}").run()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment