GithubHelp home page GithubHelp logo

cetaqueue's Introduction

Server

Install docker + docker-compose, and then:

docker-compose up --build -d

and go to http://localhost:5000 to access the build queue.

Worker

Enter worker folder, then

docker-compose up --build -d

You can connect multiple workers if you like

Push job

The spec for the job is defined by the Dockerfile. Important notes:

  • The CMD is the definition of the job to be done in the Dockerfile
  • All files should be pushed into the Docker image that will be needed for the build
  • All commands will be run by a user that has r/w access to the /output folder
  • The Dockerfile + contents of .zip file should allow for a runnable Docker image

Here is a minimal example Dockerfile:

FROM continuumio/miniconda3
COPY simple.py .
CMD python -u simple.py

where simple.py does nothing more than

with open("/output/hihih.txt",'w') as fp:
   fp.write('hello')

A Python script that will post this job with the requests library reads like

import requests, os, zipfile
url = 'http://localhost:5000/add_job'

# Absolute paths to the files, needed if this script is run from
# another working directory
zname = os.path.join(os.path.dirname(__file__),'data.zip')
dname = os.path.join(os.path.dirname(__file__),'simple.Dockerfile')
sname = os.path.join(os.path.dirname(__file__),'simple.py')

# Pack up the simple.py file into a zip file
with zipfile.ZipFile(zname, 'w') as myzip:
    myzip.write(sname, arcname='simple.py')

# Do the POST with requests library
files = {'file': ('data.zip', open(zname, 'rb'), 'application/zip')}
Dockerfile = open(dname).read()
r = requests.post(url, files=files, data= dict(Dockerfile=Dockerfile))
# Print the reponse for debugging purposes
print(r.text)

# Cleanup the generated zip file
if os.path.exists(zname): os.remove(zname)

cetaqueue's People

Contributors

ibell avatar

Watchers

 avatar  avatar

Forkers

afcarl

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.