Tue, 23 Jun 2015 10:30:08 +0300
Initial commit.
ioannis@0 | 1 | SCC access script |
ioannis@0 | 2 | ================= |
ioannis@0 | 3 | |
ioannis@0 | 4 | This small scripts permits interacting with the Single Calculus Chain through |
ioannis@0 | 5 | the command line. Specifically, with the script you can: |
ioannis@0 | 6 | |
ioannis@0 | 7 | * Upload a file to the SCC for processing |
ioannis@0 | 8 | * Download the processed files and graphs |
ioannis@0 | 9 | * Delete an existing measurement from the SCC (with appropriate privileges) |
ioannis@0 | 10 | |
ioannis@0 | 11 | The main functions are implemented in a class (SCC) that you can also import |
ioannis@0 | 12 | and use in your custom scripts. |
ioannis@0 | 13 | |
ioannis@0 | 14 | The script does not provide any feedback if a file upload fails. Before using |
ioannis@0 | 15 | the script, you will need to upload some files manually and be confident that |
ioannis@0 | 16 | your SCC file format and processing settings are correct. |
ioannis@0 | 17 | |
ioannis@0 | 18 | Please note that this is not part of the "official" SCC tools. I will update |
ioannis@0 | 19 | it when I have time but I cannot guarantee to maintain it in the long run. |
ioannis@0 | 20 | |
ioannis@0 | 21 | Any suggestions for improvements and new features are more than welcome. |
ioannis@0 | 22 | |
ioannis@0 | 23 | Installation |
ioannis@0 | 24 | ------------ |
ioannis@0 | 25 | |
ioannis@0 | 26 | The only requirement for running this program is the requests python module. |
ioannis@0 | 27 | If you have pip installed you can install it by:: |
ioannis@0 | 28 | |
ioannis@0 | 29 | pip install requests. |
ioannis@0 | 30 | |
ioannis@0 | 31 | See http://docs.python-requests.org/en/latest/user/install/ for more details. |
ioannis@0 | 32 | |
ioannis@0 | 33 | |
ioannis@0 | 34 | Settings |
ioannis@0 | 35 | -------- |
ioannis@0 | 36 | You will need to change some user-defined settings in a settings.py file. You |
ioannis@0 | 37 | can rename the settings.sample.py file to settings.py and follow the instructions |
ioannis@0 | 38 | there. |
ioannis@0 | 39 | |
ioannis@0 | 40 | Specifically, you will need to: |
ioannis@0 | 41 | |
ioannis@0 | 42 | 1. Change the BASIC_LOGIN and DJANGO_LOGIN to your credentials. |
ioannis@0 | 43 | 2. Change the OUTPUT_DIR to the location were the results will be stored. |
ioannis@0 | 44 | |
ioannis@0 | 45 | Please not that it's not a good idea to store your own credentials in the settings |
ioannis@0 | 46 | file. The standard user has "Station Management" privileges and if the credentials |
ioannis@0 | 47 | are stolen, someone could change/delete the stations settings from the SCC database. |
ioannis@0 | 48 | For this, it is better to use a used account with minimum access settings, that |
ioannis@0 | 49 | can only upload files and measurements. |
ioannis@0 | 50 | |
ioannis@0 | 51 | |
ioannis@0 | 52 | Usage |
ioannis@0 | 53 | ----- |
ioannis@0 | 54 | |
ioannis@0 | 55 | You can upload a file specifying the username and the system id:: |
ioannis@0 | 56 | |
ioannis@0 | 57 | python scc_access.py 20110101po01.nc 125 |
ioannis@0 | 58 | |
ioannis@0 | 59 | If you want to wait for the processing to finish and download the resulting files |
ioannis@0 | 60 | you need to define the -p flag:: |
ioannis@0 | 61 | |
ioannis@0 | 62 | python scc_access.py 20110101po01.nc 125 -p |
ioannis@0 | 63 | |
ioannis@0 | 64 | If you want to delete an existing measurement id from the database use the -d flag and |
ioannis@0 | 65 | the measurement id:: |
ioannis@0 | 66 | |
ioannis@0 | 67 | python scc_access.py -d 20110101po01 |
ioannis@0 | 68 | |
ioannis@0 | 69 | For more information on the syntax type:: |
ioannis@0 | 70 | |
ioannis@0 | 71 | python scc_access.py -h |