Giter VIP home page Giter VIP logo

pypyr-scheduler-server's Introduction

Logo

Schedule pypyr pipelines with apscheduler and control them via REST. The API interface is provided by connexion.

Travis (.org) Coveralls github Documentation Status GitHub

Documentation status

This documentation is in a very early stage and many things could be missing or wrong. Please rely on the code for now.

Install

Make a new venv, activate it, clone the repo, run pip install. No pypi release yet. We recommend using pipenv, which makes it easy to run commands inside a virtual env without the need to create or activate it:

pip install --user pipenv  # only needed once per python install
pipenv install
pipenv run server

Usage

pypyr-scheduler needs a shared secret between the server and the client. It reads it from the environment variable PYRSCHED_SECRET. If the server does not see a secret it generates it and writes it to its logfile for later use. If there is a secret set in the environment, it is used.

A client needs the same shared secret.

Development / Testing

Run pipenv run server. Now you can connect to the server with a suitable client. Currently available are pypyr-scheduler-cli and pypyr-scheduler-rpc-client with the first one depending on the latter.

Production deployment

TBD.

Documentation

Detailed documentaion is available on ReadTheDocs. It is generated from the docs/source folder in this repository. Feel free to send a PR is you find any typos.

Development

Run tests with pipen run tests.

Quick links

Related projects

pypyr is the workhorse underlying pypyr-scheduler. It runs pipelines defines as .yaml file and has many different pipeline steps included. Check it out, if you need a simple task automation for one-shot execution.

Flask-APScheduler provides a similar way to run job within flask as server. It even provides a REST-API. Try this if you don't need the functionality of pypyr.

pypyr-scheduler-server's People

Contributors

dependabot[bot] avatar dzerrenner avatar kbecke23 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

pypyr-scheduler-server's Issues

Descriptions in command line help are not consistent.

Describe the bug
Descriptions in command line help are not consistent. Sometimes, they end with a ".", sometimes not

To Reproduce
run python -m pyrsched -h

Expected behavior
The descriptions should either end with a period or not, but all the same.

pipeline logs get created but have no content

Describe the bug
Logfiles for pipelines are created but contain no log entries

To Reproduce
Steps to reproduce the behavior:

  1. Upload a pipeline
  2. Create a job
  3. Start the job

Expected behavior
The pipeline logs to its own log

error on pipeline upload

Describe the bug
While uploading a pipeline with the --enable-upload switch on, a pipeline gets not saved on the filesystem.

To Reproduce
Steps to reproduce the behavior:

  1. Start development server with --enable-upload
  2. Upload a pipeline file via the swagger ui console
  3. Look at the (default) pipelinesdirectory for the uploaded file.

Expected behavior
Pipeline was uploaded and saved to the file system.

DEBUG:connexion.decorators.validation:http://localhost:5000/pipelines/pipeline_now.yaml validating parameters...
DEBUG:connexion.decorators.parameter:Function Arguments: ['filename', 'body']
INFO:pyrsched.api.pipelines:POST /pipelines/pipeline_now.yaml
INFO:pyrsched.api.pipelines:saving file contents to /home/dzerrenn/projects/pypyr-scheduler/pipelines/pipeline_now.yaml
ERROR:pyrsched.app:Exception on /pipelines/pipeline_now.yaml [POST]
Traceback (most recent call last):
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/connexion/decorators/decorator.py", line 73, in wrapper
    response = function(request)
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/connexion/decorators/uri_parsing.py", line 132, in wrapper
    response = function(request)
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/connexion/decorators/validation.py", line 165, in wrapper
    response = function(request)
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/connexion/decorators/validation.py", line 339, in wrapper
    return function(request)
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/connexion/decorators/decorator.py", line 44, in wrapper
    response = function(request)
  File "/home/dzerrenn/.local/share/virtualenvs/pypyr-scheduler-UBNwg3Am/lib/python3.6/site-packages/connexion/decorators/parameter.py", line 126, in wrapper
    return function(**kwargs)
  File "/home/dzerrenn/projects/pypyr-scheduler/pyrsched/api/pipelines.py", line 55, in create
    return _save_file(filename, body)
  File "/home/dzerrenn/projects/pypyr-scheduler/pyrsched/api/pipelines.py", line 44, in _save_file
    content.save(str(target))
AttributeError: 'bytes' object has no attribute 'save'
DEBUG:connexion.apis.flask_api:Getting data and status code
DEBUG:connexion.apis.flask_api:Got data and status code (500)
INFO:werkzeug:127.0.0.1 - - [12/Dec/2019 08:43:51] "POST /pipelines/pipeline_now.yaml HTTP/1.1" 500 -

example configuration files are not packaged together with pyrsched

Describe the bug
If the package is installed via pip install, there are no default config files.

To Reproduce
Steps to reproduce the behavior:

  1. run pip install pypyr-scheduler
  2. run python -m pyrsched

Expected behavior
Server starts with default config

Additional context
Startup error, FileNotFound, all config files are gone.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.