Created
December 1, 2017 17:59
-
-
Save nitinbhojwani/457377e8084f87e903967a2e76cc07f3 to your computer and use it in GitHub Desktop.
Run Python script inside Docker container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3 | |
| ADD script.py / | |
| CMD [ "python", "-u", "./script.py" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time, sched | |
| # | |
| # Define steps functions here | |
| # | |
| # main function | |
| def main(sc): | |
| try: | |
| # Call steps functions here | |
| except Exception as e: | |
| print('Exception Occured', e) | |
| s.enter(30, 1, main, (sc,)) | |
| if __name__ == '__main__': | |
| s = sched.scheduler(time.time, time.sleep) | |
| s.enter(30, 1, main, (s,)) | |
| s.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment