Giter Site home page Giter Site logo

lorenzo-rovigatti / oxdna-web Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sulcgroup/oxdna-web

0.0 2.0 0.0 31.44 MB

Environment for running oxdna.org webserver for oxDNA/oxRNA simulation submission and analysis

License: GNU General Public License v3.0

Python 38.32% Shell 0.34% JavaScript 13.07% CSS 0.85% HTML 47.42%

oxdna-web's Introduction

oxDNA.org

Welcome to oxdna.org, this is a repository for running a user-friendly oxDNA webserver.

Note, you are free to run the server as-is, by cloning and running main.py, but it is available as a packaged Vagrant virtualbox, allowing you to easily setup a proper environment with all necessary libraries and software (MySQL, Flask, Slurm, etc...). The environment can be seen here: https://github.com/rjro/azDNA_env

Guidelines

This project uses Python modules to separate functionality and logic. The "Jobs" module in Jobs.py handles the creation and management of jobs, and the "Accounts" module in Accounts.py handles the creation and management of accounts. Please follow this design pattern.

The main entry-point of the application, where all the routes are defined, can be found in main.py.

When interfacing with the MySQL database, ensure that you handle and close your connections properly. See the section Interfacing with the Database.below for more information.

Running as a Production Server

If you invoke "python3 main.py" you will be running the development version of the Flask webserver, but it is not suitable for production, is not stable and does not scale.

To run a proper production server, you will need to use gunicorn.

You must then comment out the "app.run()" call from main.py, create a new file (called wsgi.py), and add the following code:

This functionality will soon be integrated into this repository by default

from main import app

if __name__ == "__main__":
    app.run()

You then start gunicorn from the command line with:

gunicorn --bind 0.0.0.0:9000 wsgi:app --workers=3

Interfacing with the Database

This application makes use of the pymysql and pymysql-pool libraries for interfacing with MySQL.

You can see how this interface is configured within the Database module. Ten connections are created for interfacing with the MySQL database, these connections are then stored in a pool and re-used throughout the lifecycle of the application.

In order to use a connection, use the following procedure:

import Database

connection = Database.pool.get_connection()
results = None

with connection.cursor() as cursor:
	cursor.execute("SELECT * FROM Users")
	results = cursor.fetchall()

#Remember this!
connection.close()

Please be sure to close your connection, or else the server will crash if it exhausts the connection pool.

oxdna-web's People

Contributors

aatmikmallya avatar erikpoppleton avatar rjro avatar rodenluo avatar sulcgroup avatar lorenzo-rovigatti avatar gamer43 avatar jbaca62 avatar akodiat avatar sshar118 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.