Skip to content
Snippets Groups Projects
Select Git revision
  • 7bd846058e7eb60dbc048765086aa30f236accd3
  • master default protected
  • enxhi_issue460_remove_TOAR-I_access
  • michael_issue459_preprocess_german_stations
  • sh_pollutants
  • develop protected
  • release_v2.4.0
  • michael_issue450_feat_load-ifs-data
  • lukas_issue457_feat_set-config-paths-as-parameter
  • lukas_issue454_feat_use-toar-statistics-api-v2
  • lukas_issue453_refac_advanced-retry-strategy
  • lukas_issue452_bug_update-proj-version
  • lukas_issue449_refac_load-era5-data-from-toar-db
  • lukas_issue451_feat_robust-apriori-estimate-for-short-timeseries
  • lukas_issue448_feat_load-model-from-path
  • lukas_issue447_feat_store-and-load-local-clim-apriori-data
  • lukas_issue445_feat_data-insight-plot-monthly-distribution
  • lukas_issue442_feat_bias-free-evaluation
  • lukas_issue444_feat_choose-interp-method-cams
  • 414-include-crps-analysis-and-other-ens-verif-methods-or-plots
  • lukas_issue384_feat_aqw-data-handler
  • v2.4.0 protected
  • v2.3.0 protected
  • v2.2.0 protected
  • v2.1.0 protected
  • Kleinert_etal_2022_initial_submission
  • v2.0.0 protected
  • v1.5.0 protected
  • v1.4.0 protected
  • v1.3.0 protected
  • v1.2.1 protected
  • v1.2.0 protected
  • v1.1.0 protected
  • IntelliO3-ts-v1.0_R1-submit
  • v1.0.0 protected
  • v0.12.2 protected
  • v0.12.1 protected
  • v0.12.0 protected
  • v0.11.0 protected
  • v0.10.0 protected
  • IntelliO3-ts-v1.0_initial-submit
41 results

test_join.py

Blame
  • simple_unicore.py 2.06 KiB
    import json
    import pyunicore.client as uc_client
    import pyunicore.credentials as uc_credentials
    
    from hidden_settings import (
            UNICORE_BASE, 
            UNICORE_USER, UNICORE_PASSWORD
            )
    
    base_url = f"{UNICORE_BASE}JURECA/rest/core"
    #base_url = f"{UNICORE_BASE}JUWELS/rest/core"
    
    # Authentification/Authorization
    credentials = uc_credentials.UsernamePassword(UNICORE_USER, UNICORE_PASSWORD)
    
    # examples for transfering files
    
    # remote base directory that we want to access (why is it automatically already in my one and only project
    # what if I had two projects?)
    #base_directory = "cjicg21/schroeder5/DATA/TEST/CTM/201807/18"
    base_directory = "schroeder5/DATA/TEST/CTM/201807/18"
    download_filename = "ctmout_wrf_cutcropped_199_h09.nc"
    
    transport = uc_client.Transport(credentials)
    #home = uc_client.Storage(transport, f"{base_url}/storages/HOME")
    #print(home.contents())
    scratch = uc_client.Storage(transport, f"{base_url}/storages/SCRATCH")
    dfile = scratch.stat(f"{base_directory}/{download_filename}")
    dfile.download(download_filename)
    
    # examples for unicore (submitting commands/scripts/bash scripts)
    
    client = uc_client.Client(credentials, base_url)
    #job_description = {'Executable': "/p/project/deepacf/schroeder5/mlair/run_hdfml_batch.bash", 'Arguments' :[], }
    #job_description = {'Executable': "/bin/ls", 'Arguments' :["-lisa", "$HOME"], }
    #job_description = {'Executable': "/p/project/cjicg21/schroeder5/Destine_AQ/start_destine_demonstrator.sh", "Job type": "ON_LOGIN_NODE", 'Arguments':[], }
    job_description = {'Executable': "/bin/cd /p/project/cjicg21/schroeder5/Destine_AQ;/bin/ls", "Job type": "ON_LOGIN_NODE", 'Arguments':[], }
    job = client.new_job(job_description)
    print("Submitted (on login node!): %s" % job)
    
    # let's wait while the job is still running
    job.poll()
    
    print(json.dumps(job.properties, sort_keys=True, indent=4))
    working_dir = job.working_dir
    print (json.dumps(working_dir.properties, sort_keys=True, indent=4))
    for f in working_dir.listdir("."):
        print(f)
    stdout_content = working_dir.stat("stdout").raw().readlines()
    for line in stdout_content:
        print(line)