Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: more ingest instructions

...

R2D2 is a lightweight Python API, an SQL schema, and a live, production, cloud-based MySQL database server that Skylab utilizes for data assimilation experiments. The current R2D2 is version 2 which uses Python MySQL Connector to execute queries directly to the remote, production MySQL database located on us-east-2 on r2d2.jcsda.org on port 3306. The new R2D2 is version 3 which uses a standardized client / server architecture using REST HTTP API calls well-defined by an OpenAPI 3.0 specification matching R2D2's SQL schema. Both the client and REST server APIs for R2D2 V3 are item-based and not function-based as in the R2D2 V2 database connector API. The SQL schema for V2 and V3 are identical

Terminology



Procedures

Adding Files to EWOK_STATIC_DATA to HPC environments

...

  1. Log into the HCP where the data to be ingested is located, become the jedipara or role-jcsda user depending on HPC, and go to the location for R2D2 archive.
    Code Block
    languagebash
    themeMidnight
    ssh -XY <user_name>@login.nccs.nasa.gov
    sudo -iu jedipara 
    cd /discover/nobackup/projects/jcsda/s2127
  2. Set up your venv, using setup.sh, that was created in the requirements section. You might need to update $JEDI_ENV.
    Code Block
    languagebash
    themeMidnight
    vi setup.sh			# Verify JEDI_ENV location
    source setup.sh
  3. Log into a screen session so no work will be lost if you get logged out
    Code Block
    languagebash
    themeMidnight
    screen -S r2d2_ingest
  4. Verify that your venv is still loaded, if not re-load following the same steps as #2.
  5. Check your r2d2 admin utility access. If this does not work make sure you followed the requirements.
    Code Block
    languagebash
    themeMidnight
    python3
    >>> from r2d2.util.admin_util import AdminUtil
    Use the "AdminUtil.move_experiment" function to move the experiment given in the r2d2-ingest ticket to oper and the correct data_store. You can refer to the r2d2 code to ceck for arguments needed and how to use them
  6. Before moving an entire experiment, you can check which files will be moved by using R2D2Data.search, looping over all of the R2D2Data items (analysis, bias_correction, diagnostic, feedback, forecast, media, observation).
    Code Block
    languagebash
    themeMidnight
    >>> AdminUtil.move_experiment(source_experiment='e8254afrom r2d2 import R2D2Data
    >>> R2D2Data.search(item='forecast', target_experiment='opere65ab2', ensemble_data_store_type='geosensemble')
  7. To get the data to the other HPCs, on your origin system you will sync to S3 and then sync the data stores.
    Code Block
    languagebash
    themeMidnight
    /path/to/aws s3 sync --size-only --profile=jcsda-usaf-aws-us-east-2 /discover/nobackup/projects/jcsda/s2127/r2d2-archive-nccs/ s3://r2d2-archive-jcsda-usaf-aws-us-east-2/
    
    python3
    >>> from r2d2.util.admin_util import AdminUtil
    >>> AdminUtil.sync_data_stores(source_data_store='r2d2-archive-nccs', target_data_store='r2d2-archive-jcsda-usaf-aws-us-east-2')
  8. )
    # Returns:  [{'forecast_index': 3207928, 'model': 'geos', 'experiment': 'e65ab2', 'file_extension': 'nc4', 'resolution': 'c90', 'domain': '', 'file_type': 'bkg', 'step': 'PT3H', 'tile': -9999, 'member': -9999, 'date': datetime.datetime(2022, 2, 15, 6, 0), 'create_date': datetime.datetime(2024, 8, 23, 20, 52, 47), 'mod_date': datetime.datetime(2024, 8, 23, 20, 52, 47)}]
  9. Use the "AdminUtil.move_experiment" function to move the experiment given in the r2d2-ingest ticket to oper and the correct data_store. You can refer to the r2d2 code to check for arguments needed and how to use themLog into MSU's Orion and sync from S3. Then you can proceed to log into the other HPCs and sync NWSC/SSEC systems from MSU using the sync scripts in ~/bin.
    Code Block
    languagebash
    themeMidnight
    >>> AdminUtil.move_experiment(source_experiment='<expid>', target_experiment='oper', ensemble_data_store_type='<data_store_type>')
  10. To get the data to the other HPCs, on your origin system you will sync to S3 and then sync the data stores.
    Code Block
    languagebash
    themeMidnight
    /path/to/aws ssh -Y <user_name>@orion-login.hpc.msstate.edu
    sudo -su role-jcsda
    # Load venv to get aws modules or load modules following jedi-docs
    aws s3 sync --size-only --profile=jcsda-usaf-aws-us-east-2 s3://r2d2discover/nobackup/projects/jcsda/s2127/r2d2-archive-nccs/ s3://r2d2-archive-jcsda-usaf-aws-us-east-2/ /work2/noaa/jcsda/role-jcsda/r2d2-archive-msu/
    
    python3
    >>> from r2d2.util.admin_util import AdminUtil
    >>> AdminUtil.sync_data_stores(source_data_store='r2d2-archive-nccs', target_data_store='r2d2-archive-jcsda-usaf-aws-us-east-2')
  11. Log into MSU's Orion, rsync from S3 and sync the data_stores. Then you can proceed to log into the other HPCs and sync NWSC/SSEC systems from MSU using the sync scripts in ~/bin and sync the data_stores.
    Code Block
    languagebash
    themeMidnight
    ssh -Y <user_name>@orion-login.hpc.msstate.edu
    sudo -su role-jcsda
    # Load venv to get aws modules or load modules following jedi-docs
    # To sync archive:
    aws s3 sync --size-only --profile=jcsda-usaf-aws-us-east-2 s3://r2d2-archive-jcsda-usaf-aws-us-east-2/ /work2/noaa/jcsda/role-jcsda/r2d2-archive-msu/
    # To sync data_stores:
    python3
    >>> from r2d2.util.admin_util import AdminUtil
    >>> AdminUtil.sync_data_stores(source_data_store='r2d2-archive-jcsda-usaf-aws-us-east-2', target_data_store='r2d2-archive-msu')
  12. Finally you will run the rsync and sync the data_stores from the other data hubs. There is a script located inside jedipara's ~/bin  directory the can be used to perform the rsync. Make sure the username is yours instead of the most recent team members. If you get an ssh error, you can remove the machine from known hosts and try again. Note, if you need to find the value for data_hub that is stored in R2D2 you can use: R2D2Index.search(item='data_hub'). Run the following steps for each data hub:
    Code Block
    languagebash
    themeMidnight
    ssh -XY <user_name>@<hpc>
    sudo -iu jedipara
    cd bin
    vi rsync-r2d2-archive-from-msu-<user-name>.sh        # Edit to your Orion username
    # Run the rsync for archive:
    bash rsync-r2d2-archive-from-msu-<user-name>.sh
    # Sync the data_stores
    python3
    >>> from r2d2.util.admin_util import AdminUtil
    >>> AdminUtil.sync_data_stores(source_data_store='r2d2-archive-jcsda-usaf-aws-us-east-2', target_data_store='r2d2-archive-<data_hub>')
    Run the rsync from the other HPCs. There is a script located inside jedipara's ~/bin  directory the can be used to perform the rsync. Make sure the username is yours instead of the most recent team members. If you get an ssh error, you can remove the machine from known hosts and try again.
    Code Block
    languagebash
    themeMidnight
    ssh -XY <user_name>@<hpc>
    sudo -iu jedipara
    cd bin
    vi rsync-r2d2-archive-from-msu-<user-name>.sh        # Edit to your Orion username
    bash rsync-r2d2-archive-from-msu-<user-name>.sh

Adding observation files to R2D2 Archive

...