Giter VIP home page Giter VIP logo

usegalaxy-eu_tpv-metascheduler-api's Introduction

tpv-metascheduler-api

Metascheduler for TPV as Service

  1. Create a venv

    python -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
  2. Run the API locally: uvicorn main:app --reload

  3. Testing the API with input data:

    1. SwaggerUI: http://127.0.0.1:8000/docs Try out > Fill out the request body: Request body:

      {
         "destinations": [
            {
               "id": "pulsar_italy",
               "abstract": false,
               "runner": "general_pulsar_1",
               "destination_name_override": "pulsar_italy",
               "cores": null,
               "mem": null,
               "gpus": null,
               "min_cores": null,
               "min_mem": null,
               "min_gpus": null,
               "max_cores": null,
               "max_mem": null,
               "max_gpus": null,
               "min_accepted_cores": null,
               "min_accepted_mem": null,
               "min_accepted_gpus": null,
               "max_accepted_cores": 8,
               "max_accepted_mem": 32,
               "max_accepted_gpus": null,
               "env": null,
               "params": null,
               "resubmit": null,
               "scheduling": {
               "require": ["pulsar"],
               "prefer": [],
               "accept": ["general"],
               "reject": []
               },
               "inherits": null,
               "context": {
                  "latitude": 50.0689816,
                  "longitude": 19.9070188 },
               "rules": {},
               "tags": null,
               "queued_job_count": 10
            },
            {
               "id": "slurm_poland",
               "abstract": false,
               "runner": "slurm",
               "destination_name_override": "slurm_poland",
               "cores": null,
               "mem": null,
               "gpus": null,
               "min_cores": null,
               "min_mem": null,
               "min_gpus": null,
               "max_cores": null,
               "max_mem": null,
               "max_gpus": null,
               "min_accepted_cores": null,
               "min_accepted_mem": null,
               "min_accepted_gpus": null,
               "max_accepted_cores": 16,
               "max_accepted_mem": 64,
               "max_accepted_gpus": null,
               "env": null,
               "params": null,
               "resubmit": null,
               "scheduling": {
               "require": [],
               "prefer": [],
               "accept": ["slurm"],
               "reject": []
               },
               "inherits": null,
               "context": {
                  "latitude": 51.9189046,
                  "longitude": 19.1343786 },
               "rules": {},
               "tags": null,
               "queued_job_count": 8
            }
         ],
         "objectstores": {
            "object_store_italy_S3_01": {
               "latitude": 50.0689816,
               "longitude": 19.9070188,
               "other_stuff_that_we_find_useful": "foobar"
            },
            "object_store_poland": {
               "latitude": 51.9189046,
               "longitude": 19.1343786,
               "other_stuff_that_we_find_useful": "foobar"
            }
         },
         "dataset_attributes": {
            "dataset_italy": {
               "object_store_id": "object_store_italy_S3_01",
               "size": 12345678
            },
            "dataset_poland": {
               "object_store_id": "object_store_poland",
               "size": 123456789
            }
         }
      }
    2. curl

      The Swagger UI can give you a curl version of your request after executing

    3. Using a python script with the requests or httpx library

      There is an example of how to do this with TPV: tpv-metascheduler-api/example_tpv_config_locations_api.yml This config can be set up with a galaxy instance or by cloning the TPV repo (the example currently depends on an open PR to this repo) test/test_scenario_esg_group_user_api contains a test that has a similar request as above to test out:

      # Clone the remote repository
      git clone https://github.com/pauldg/total-perspective-vortex.git
      # Change into the cloned repository directory
      cd total-perspective-vortex
      # Checkout the desired remote branch
      git checkout -b location_test origin/location_test
      # Create a venv for testing
      python -m venv .venv
      source .venv/bin/activate
      pip install -r requirements_test.txt
      # Run pytest for the api
      pytest -rPv  tests/test_scenarios_locations.py::TestScenarios::test_scenario_esg_group_user_api

usegalaxy-eu_tpv-metascheduler-api's People

Contributors

pauldg avatar sanjaysrikakulam avatar abdulrahmanazab avatar bgruening 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.