Giter Site home page Giter Site logo

shift_announcer's Introduction

shift_announcer.py

Introduction

This is a script that can be used to send shift scheduling emails to on-calls at CERN. It reads in a csv file that contains in each row the name of the future shifter as well as one date (corresponding to a week) during which the person is on call. Duplicate entries are forseen in case of multiple on-call weeks, e.g.:

Anton Bruckner, 31.10.2018
Igor Stravinsky, 04.02.2018
Pierre Boulez, 13.05.2018
Richard Wagner,
Igor Stravinsky, 23.03.2018

The script will collect all names and group them. It will then query the CERN phonebook (via the phonebook command installed on CERN computers) to determine a future on-call person's e-mail address. If it finds multiple matches it will query to user for the correct one, likewise in case of no results the script will query for the address to use.

A template file will be used to create the message body, where $$name$$ will be replaced by the name in the csv file and $$date$$ will be replaced by a string of the form:

You were assigned the following weeks:
[date 1]
[date 2]
[...]

If this doesn't work for you feel free to send an e-mail to the L1 DOC list [email protected] to arrange a swap with one of the other DOCs.

or

In this first period you were not assigned any shifts.

in case there were no entries with dates associated found (as with Richard Wagner in the above example).

Usage

Usage of the script is fairly straightforward:

% python3 shift_announcer.py -h 
usage: shift_announcer.py [-h] [--templateFile TEMPLATEFILE]
                          [--csvFile CSVFILE] [--fromField FROMFIELD]
                          [--logLevel LOGLEVEL] [--go_time]

Script to send out announcement emails for shift schedules.

optional arguments:
  -h, --help            show this help message and exit
  --templateFile TEMPLATEFILE
                        Path to file containing template of email body.
                        (default: template.txt)
  --csvFile CSVFILE     CSV file containing DOC names and assigned dates.
                        (default: test_file.csv)
  --fromField FROMFIELD
                        E-Mail address to be put into 'From:' field. (default:
                        [email protected])
  --logLevel LOGLEVEL   Log level. (One of 'DEBUG', 'INFO', 'WARN', 'ERR'.)
                        (default: INFO)
  --go_time             Actually send out the emails. (default: False)

In particular the --go_time option needs to be passed in order to actually send out emails. If this isn't passed the script will only construct the messages (and in DEBUG mode also output the contents onto the command line).

shift_announcer's People

Contributors

dinyar avatar

Watchers

James Cloos avatar  avatar

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.