ocean-transport / pleiades_llc_recipes

Examples of analysis of MITgcm LLC simulations of NASA Pleiades supercomputer
MIT License
8 stars 2 forks source link

Things to work on while we are waiting for Pleiades credits #10

Open rabernat opened 1 year ago

rabernat commented 1 year ago

None of this requires submitting any jobs to the Pleiades queue.

cc @rsaim

rsaim commented 1 year ago

Here is how we can access the S3 buckets on OSN in Python.

> sraza2 @ pfe21 ~/pleiades_llc_recipes (master) 20:31:32
$ ipython3
In [1]: import boto3

In [2]: session = boto3.session.Session()

In [3]: client = session.client(service_name='s3', endpoint_url='https://mghp.osn.xsede.org')

In [4]: from pprint import pprint as pp

In [5]: pp(client.list_buckets())
{'Buckets': [{'CreationDate': datetime.datetime(2021, 2, 21, 17, 29, 43, 614000, tzinfo=tzutc()),
              'Name': 'cnh-bucket-2'},
             {'CreationDate': datetime.datetime(2021, 1, 14, 1, 22, 48, 485000, tzinfo=tzutc()),
              'Name': 'llc4320_tests'}],
 'Owner': {'DisplayName': 'cnh-bucket-1 Datamanager',
           'ID': 'cnh-bucket-1_datamanager'},
 'ResponseMetadata': {'HTTPHeaders': {'content-type': 'application/xml',
                                      'date': 'Fri, 16 Dec 2022 04:32:31 GMT',
                                      'transfer-encoding': 'chunked',
                                      'x-amz-request-id': 'tx00000a5f4fbcc55ace462-00639bf4df-2991e0-default'},
                      'HTTPStatusCode': 200,
                      'HostId': '',
                      'RequestId': 'tx00000a5f4fbcc55ace462-00639bf4df-2991e0-default',
                      'RetryAttempts': 0}}

Notes:

Try to understand Chris Hill's upload scripts in https://github.com/oceantransport/pleiades_llc_recipes/tree/master/osn_transfer

These scripts creates commands usingrclone and launches them pfe using ssh. Example command created by transfer_to_osn.sh:

$ bash osn_transfer/transfer_to_osn.sh testfile.nc
Transferring "testfile.nc" to "s3://mghp.osn.xsede.org//testfile.nc".
#!/bin/bash
hostname
export RCLONE_S3_ACCESS_KEY_ID=SET_ACCESS_KEY 
export RCLONE_S3_SECRET_ACCESS_KEY=SET_SECRET_KEY 
~cnhill1/bin/rclone   --s3-no-check-bucket --multi-thread-streams 24 --s3-upload-concurrency 12 --s3-chunk-size 100M --transfers 8 --log-file=mylogfile.txt --log-level INFO   --s3-endpoint https://mghp.osn.xsede.org   copyto testfile.nc :s3:///testfile.nc.QUG3xQ3

I guess we can do equivalent things in Python.