GithubHelp home page GithubHelp logo

josiahcarlson / jobs Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 6.0 110 KB

Job input/output control with Redis

License: GNU Lesser General Public License v2.1

Makefile 3.58% Python 93.43% Roff 2.99%

jobs's People

Contributors

bra-fsn avatar daroczig avatar hugovk avatar josiahcarlson avatar tirkarthi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jobs's Issues

Deprecation warning due to invalid escape sequences in Python 3.7

Deprecation warnings are raised due to invalid escape sequences. This can be fixed by using raw strings or escaping the literals.

find . -iname '*.py' | grep -v example | xargs -P 4 -I{} python3.8 -Wall -m py_compile {}./jobs.py:282: DeprecationWarning: invalid escape sequence \d
  TS_RE = re.compile('^(\d{9,}(?:[.]\d*)?)$')
./jobs.py:283: DeprecationWarning: invalid escape sequence \d
  DT_RE = re.compile('^(\d{4})-(\d{2})-(\d{2})(?: (\d{2}):(\d{2})(?::(\d{2})(?:[.](?:\d+)?)?)?)?$')

signal handler override

I've seen some silent errors recently and after some shotgun debugging I ended up with the below minimal example:

import os
import signal
import threading
import time
#import jobs
def selfkill():
  time.sleep(5)
  os.kill(os.getpid(), signal.SIGTERM)
x = threading.Thread(target=selfkill)
x.start()
time.sleep(10)
print('OK')    

This will of course stop after 5 seconds with exit code ~143 or so, but if commenting out import jobs, it will exit without an error and exic code 0 :thinking_face:

I suspect this is happening because of https://github.com/josiahcarlson/jobs/blob/master/jobs.py#L323

I am not quite sure about the background and why we need to override the signal handler -- can you please help me understand what I am doing wrong or some pointers on how to fix this? In short, I want the above job (after uncommenting import jobs) to fail due to the SIGTERM.

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.