Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update for docker #59

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/build-on-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build on PR

on:
pull_request:
branches: [ master, develop ]

jobs:

build:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:

- name: Checkout the project
uses: actions/checkout@master

- name: Install dependancies
run: |
echo "starting docker build"
cd repo_pkg
docker build -t parallel-test .
docker run parallel-test
45 changes: 0 additions & 45 deletions .github/workflows/cron3.yaml

This file was deleted.

64 changes: 0 additions & 64 deletions .github/workflows/deploy.yml

This file was deleted.

60 changes: 0 additions & 60 deletions .github/workflows/issues.yml

This file was deleted.

127 changes: 0 additions & 127 deletions .github/workflows/test-the-package.yml

This file was deleted.

11 changes: 9 additions & 2 deletions repo_pkg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
FROM alpine
CMD ["echo", "Hello StackOverflow!"]
FROM python

WORKDIR /app
COPY *.py /app/

COPY requirements.txt /app/
RUN pip install -r /app/requirements.txt

CMD [ "python3", "parallel_example.py"]
Binary file added repo_pkg/__pycache__/test_five.cpython-38.pyc
Binary file not shown.
Binary file added repo_pkg/__pycache__/test_one.cpython-38.pyc
Binary file not shown.
14 changes: 0 additions & 14 deletions repo_pkg/hello_git.py

This file was deleted.

27 changes: 27 additions & 0 deletions repo_pkg/parallel_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import time
from datetime import datetime

from joblib import Parallel, delayed
import multiprocessing

# what are your inputs, and what operation do you want to
# perform on each input. For example...

print(datetime.now())

inputs = range(15)
def processInput(i):
print("sleeping function START")
time.sleep(5)
print("sleeping function FINISHED")
return i * i

num_cores = multiprocessing.cpu_count()

print(num_cores)

results = Parallel(n_jobs=num_cores)(delayed(processInput)(i) for i in inputs)

print(results)

print(datetime.now())
1 change: 1 addition & 0 deletions repo_pkg/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
joblib
7 changes: 7 additions & 0 deletions repo_pkg/test_five.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import time

def sleep_and_print_five():

time.sleep(5)

print("Finished process 5")
Empty file added repo_pkg/test_four.py
Empty file.
Loading