Django Remote Submission
Django Remote Submission - Published in JOSS (2017)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 6 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
✓Committers with academic emails
1 of 7 committers (14.3%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Scientific Fields
Computer Science
Computer Science -
37% confidence
Last synced: 4 months ago
·
JSON representation
Repository
The django-remote-submission is an asynchronous task/job queue using Celery Distributed Task Queue and Redis in-memory data structure store as message broker.
Basic Info
- Host: GitHub
- Owner: ornl-ndav
- License: isc
- Language: Python
- Default Branch: master
- Homepage: https://django-remote-submission.readthedocs.io/
- Size: 251 KB
Statistics
- Stars: 20
- Watchers: 3
- Forks: 5
- Open Issues: 2
- Releases: 1
Created about 9 years ago
· Last pushed about 4 years ago
Metadata Files
Readme
Changelog
Contributing
License
Authors
Codemeta
README.rst
=============================
Django Remote Submission
=============================
.. image:: https://badge.fury.io/py/django-remote-submission.png
:target: https://badge.fury.io/py/django-remote-submission
.. image:: https://travis-ci.org/ornl-ndav/django-remote-submission.png?branch=master
:target: https://travis-ci.org/ornl-ndav/django-remote-submission
.. image:: https://codecov.io/gh/ornl-ndav/django-remote-submission/branch/master/graph/badge.svg
:target: https://codecov.io/gh/ornl-ndav/django-remote-submission
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.848749.svg
:target: https://doi.org/10.5281/zenodo.848749
.. image:: http://joss.theoj.org/papers/10.21105/joss.00366/status.svg
:target: http://joss.theoj.org/papers/10.21105/joss.00366
A Django application to manage long running job submission, including starting the job, saving logs, and storing results.
Features
--------
* Able to connect to any server via SSH user/password or key-based authentication.
* Able to transfer and launch any script in the remote server (e.g. python or bash scripts).
* Able to capture and receive logs and write them to a database in realtime.
* Able to return any modified files from the remote server.
* Uses WebSockets to notify the Web Client of the Job status: ``initial``, ``submitted``, ``success`` or ``failure``.
* Uses WebSockets to provide Job Log (standard output and standard error) in real time to the Web Client.
Documentation
-------------
The full documentation is at https://django-remote-submission.readthedocs.org.
==========
Quickstart
==========
Install Django Remote Submission::
pip install django-remote-submission
Then use it in a project:
.. code:: python
from django_remote_submission.models import Server, Job
from django_remote_submission.tasks import submit_job_to_server
server = Server.objects.get_or_create(
title='My Server Title',
hostname='example.com',
port=22,
)[0]
python2_interpreter = Interpreter.objects.get_or_create(
name = 'python2',
path = '/usr/bin/python2.7 -u',
)[0]
python3_interpreter = Interpreter.objects.get_or_create(
name = 'python3',
path = '/usr/bin/python3.5 -u',
)[0]
server.interpreters.set([python2_interpreter,
python3_interpreter])
job = Job.objects.get_or_create(
title='My Job Title',
program='print("hello world")',
remote_directory='/tmp/',
remote_filename='test.py',
owner=request.user,
server=server,
interpreter=python2_interpreter,
)[0]
# Using delay calls celery:
modified_files = submit_job_to_server.delay(
job_pk=job.pk,
password=request.POST.get('password'),
)
For testing, sometimes is useful to bypass the remote server and run the task in the local computer.
For this, the ``submit_job_to_server`` routine can be called with the argument ``remote=False``.
The function above would be:
.. code:: python
modified_files = submit_job_to_server.delay(
job_pk=job.pk,
password=request.POST.get('password'),
remote=False,
)
Note that it stills use Celery. It just ignores the password passed as argument.
To avoid storing the password one can deploy the client public key in the server.
.. code:: python
from django_remote_submission.tasks import copy_key_to_server
copy_key_to_server(
username=env.remote_user,
password=env.remote_password,
hostname=env.server_hostname,
port=env.server_port,
public_key_filename=None, # finds it automaticaly
)
And it can be deleted once the session is finished:
.. code:: python
from django_remote_submission.tasks import delete_key_from_server
delete_key_from_server(
username=env.remote_user,
password=env.remote_password,
hostname=env.server_hostname,
port=env.server_port,
public_key_filename=None,
)
=================
Running the Tests
=================
Does the code actually work?
::
source /bin/activate
(myenv) $ pip install -r requirements_test.txt
(myenv) $ make test
Some of the tests use a test server to check the functional aspects of the
library. Specifically, it will try to connect to the server multiple times, run
some programs, and check that their output is correct.
To run those tests as well, copy the ``.env.base`` file to ``.env`` and modify
the variables as needed. If this file has not been set up, then those tests
will be skipped, but it won't affect the success or failure of the tests.
Running tests independtely, e.g.::
pytest -v tests/test_models.py
pytest -v tests/test_models.py::test_server_string_representation
===================
Running the Example
===================
Set the ``example/.env`` file. Copy or rename ``example/.env.base`` and fill in the details of the remote machine where the ``sshd`` server is running::
EXAMPLE_PYTHON_PATH
EXAMPLE_PYTHON_ARGUMENTS
EXAMPLE_SERVER_HOSTNAME
EXAMPLE_SERVER_PORT
EXAMPLE_REMOTE_DIRECTORY
EXAMPLE_REMOTE_FILENAME
EXAMPLE_REMOTE_USER
EXAMPLE_REMOTE_PASSWORD
Set up the example's virtualenv::
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
Launch Redis::
redis-server
Launch Celery::
cd example
celery -A server.celery worker --loglevel=info
Launch Django::
cd example
./manage.py makemigrations
./manage.py migrate
./manage.py loaddata fixtures/initial_data.json
# You may want to create another user:
# python manage.py createsuperuser
./manage.py runserver
Open in the browser one of the links below. The password for admin is ``admin123`` unless you prefer to use the created password::
# For the Admin Interface
http://localhost:8000/admin/
# For the REST API
http://localhost:8000/
# To test Job creation with live status update
http://127.0.0.1:8000/example/
=============
Web Interface
=============
The app provides two web sockets to see in real time the Job Status and the Log associated to a Job.
Those are defined in ``routing.py``::
path=r'^/job-user/$'
path=r'^/job-log/(?P[0-9]+)/$'
The ``example`` app comes with the Live Job Status and Live Log examples. See::
# Jobs
http://127.0.0.1:8000/example/
# Job 123 Log
http://127.0.0.1:8000/logs/123/
Both files::
django-remote-submission/example/templates/example_job_status.html
django-remote-submission/example/templates/example_job_log.html
Have the client side web socket code to interact with the ``django-remote-submission`` app.
Also to include the Live information on a web app it is worth looking at the celery configuration:
``django-remote-submission/example/server/celery.py``
and the WebSockets routing:
``django-remote-submission/example/server/routing.py``
============
Useful notes
============
The Results files are stored in MEDIA. So add to your setings something similar to:
.. code:: python
MEDIA_URL = '/media/'
MEDIA_ROOT = '../dist/media'
To make media available in DEBUG mode, you might want to add to the main ``urls.py``:
.. code:: python
if settings.DEBUG:
# Serving files uploaded by a user during development
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
=======
Credits
=======
Tools used in rendering this package:
* Cookiecutter_
* `cookiecutter-djangopackage`_
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage
This research used resources at the High Flux Isotope Reactor and Spallation Neutron Source, a DOE Office of Science User Facility operated by the Oak Ridge National Laboratory.
Owner
- Name: ORNL Neutron Data Analysis & Visualization Division
- Login: ornl-ndav
- Kind: organization
- Repositories: 2
- Profile: https://github.com/ornl-ndav
JOSS Publication
Django Remote Submission
Published
August 27, 2017
Volume 2, Issue 16, Page 366
Authors
Tags
django job submission batch schedulingCodeMeta (codemeta.json)
{
"@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld",
"@type": "Code",
"author": [
{
"@id": "0000-0002-6269-7881",
"@type": "Person",
"email": "thobson2@vols.utk.edu",
"name": "Tanner Hobson",
"affiliation": "Oak Ridge National Laboratory"
},
{
"@id": "0000-0002-9931-8304",
"@type": "Person",
"email": "ferrazlealrm@ornl.gov",
"name": "Ricardo M. Ferraz Leal",
"affiliation": "Oak Ridge National Laboratory"
},
{
"@id": "0000-0002-5560-6478",
"@type": "Person",
"email": "doucetm@ornl.gov",
"name": "Mathieu Doucet",
"affiliation": "Oak Ridge National Laboratory"
}
],
"identifier": "",
"codeRepository": "https://github.com/ornl-ndav/django-remote-submission",
"datePublished": "2017-07-24",
"dateModified": "2017-07-24",
"dateCreated": "2017-07-24",
"description": "A Django application to manage long running job submission, including starting the job, saving logs, and storing results.",
"keywords": "django, job submission, batch scheduling",
"license": "ISC",
"title": "Django Remote Submission",
"version": "v0.11.1"
}
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Ricardo M. Ferraz Leal | r****l@g****m | 97 |
| Tanner Hobson | t****5@g****m | 87 |
| Tanner Hobson | t****n@d****s | 7 |
| Mathieu Doucet | m****0@y****m | 6 |
| Dustin J. Mitchell | d****n@v****s | 5 |
| Hobson | t****f@b****v | 5 |
| Arfon Smith | a****n | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 19
- Total pull requests: 21
- Average time to close issues: about 1 month
- Average time to close pull requests: about 11 hours
- Total issue authors: 3
- Total pull request authors: 4
- Average comments per issue: 1.37
- Average comments per pull request: 0.86
- Merged pull requests: 21
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ricleal (12)
- player1537 (5)
- djmitche (2)
Pull Request Authors
- player1537 (14)
- djmitche (5)
- arfon (1)
- mdoucet (1)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 35 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 30
- Total maintainers: 2
pypi.org: django-remote-submission
A Django application to manage long running job submission, including starting the job, saving logs, and storing results.
- Homepage: https://github.com/ornl-ndav/django-remote-submission
- Documentation: https://django-remote-submission.readthedocs.io/
- License: ISCL
-
Latest release: 2.1.0
published over 7 years ago
Rankings
Dependent packages count: 10.1%
Forks count: 13.3%
Stargazers count: 13.7%
Average: 16.1%
Dependent repos count: 21.6%
Downloads: 21.7%
Maintainers (2)
Last synced:
4 months ago
Dependencies
example/requirements.txt
pypi
- celery *
- channels_redis *
- django *
- django-celery-results *
- django-environ *
requirements_dev.txt
pypi
- bumpversion >=0.5.3 development
- wheel >=0.29.0 development
requirements_docs.txt
pypi
- Sphinx >=1.7.0
- django-sphinx-autodoc >=0.2
- docutils >=0.13.1
requirements_test.txt
pypi
- coverage >=4.2 test
- django-environ >=0.4.0 test
- flake8 >=2.1.0 test
- flake8_docstrings * test
- mock >=1.0.1 test
- pytest >=3.2.1 test
- pytest-cov >=2.5.1 test
- pytest-django >=3.1.2 test
- pytest-mock >=1.6.2 test
- tox >=1.7.0 test
setup.py
pypi
- Add *
- Celery *
- Filter *
- Helpful *
- Library *
- Web *
- celery >=4.1
- channels >=2.1.1
- django >=2.0.2
- django-filter >=1.1.0
- django-model-utils >=3.0.0
- djangorestframework >=3.6.3
- paramiko >=2.2.1
- six >=1.10.0
