Coder Social home page Coder Social logo

cmstrackerdpg / mlplayground Goto Github PK

View Code? Open in Web Editor NEW
4.0 14.0 2.0 21.59 MB

Web application for collaborating to build ML models for Tracker DQM/DC

Python 14.35% CSS 0.13% HTML 6.23% Shell 0.37% Jupyter Notebook 34.82% JavaScript 43.94% Dockerfile 0.16%

mlplayground's Introduction

DQM Playground

Django CI - Updated Code style: black

The goal of the DQM Playground is to serve information from various sources (OMS, Run Registry, DQM GUI, static files from the ML4DQM effort) in order to ease model development and to provide a place to compare the predictions of the various models.

Requirements

  • A postgresql database.
  • A ROOT installation.
  • An .env file which contains the variables listed below.

Environmental variables

All must be stored in a file named .env:

DJANGO_DATABASE_ENGINE
DJANGO_DEBUG
DJANGO_DATABASE_NAME
DJANGO_DATABASE_PASSWORD
DJANGO_DATABASE_USER
DJANGO_DATABASE_HOST
DJANGO_DATABASE_PORT
DJANGO_SECRET_KEY
DIR_PATH_DQMIO_STORAGE

DIR_PATH_DQMIO_STORAGE (str)

List of directories to look into for DQM files (csv, nanoDQMIO). Separate multiple directories with a colon (:), e.g.:

DIR_PATH_DQMIO_STORAGE = "/dir/to/dqm/files:/this/is/another/dir"

Behavior

Management Commands

histograms

  • exctract_lumisections_histos1D_csv: Given a CSV containing 1D Lumisection Histograms, this command will parse the file's contents and create appropriate entries in the LumisectionHistogram1D table.
  • exctract_lumisections_histos2D_csv: Given a CSV containing 2D Lumisection Histograms, this command will parse the file's contents and create appropriate entries in the LumisectionHistogram2D table.

Authentication

External applications

To query the API from a third-party application, you will need to generate a token (from the admin dashboard)

Development

Database

For storing histograms, the ArrayField is used, so a PostgreSQL database is recommended for running the project locally.

Installing pgadmin4 is also recommended for easier interfacing with the DB.

API access via JS

Accessing the API via a rendered HTML page requires session authentication of the DRF. This is done by:

  1. Requiring the user to login to the page that contains the JS that does the requests
  2. Configuring DRF to accept SessionAuthentication
  3. Adding the X-CSRF-TOKEN header to the API request and setting its value to the CSRF token which you can get by accessing the cookies stored in the current page. [https://docs.djangoproject.com/en/4.0/ref/csrf/#ajax]

[https://www.django-rest-framework.org/topics/ajax-csrf-cors/]

Building the Dockerfile locally

If outside the CERN GPN, you will need to create a bridge (via, e.g. sshuttle) first.

Then, cd into the directory where the Dockerfile is and run:

sudo docker build . --build-arg ROOT_TAG_NAME=v6-24-08 --network="host"

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.