mytardis datafile¶
usage: mytardis datafile [-h] {list,get,create,update,download,upload} ...
Positional Arguments¶
- command
Possible choices: list, get, create, download, upload, update, verify
available commands
Sub-commands:¶
list¶
Display a list of datafile records.
mytardis datafile list
[--dataset DATASET] [--directory DIRECTORY] [--filename FILENAME]
[--limit LIMIT] [--offset OFFSET] [--order_by ORDER_BY] [--json]
[--filter FILTER]
EXAMPLE
$ mytardis datafile list --dataset 35
Model: DataFile
Query: http://mytardisdemo.erc.monash.edu.au/api/v1/dataset_file/?format=json&dataset__id=35
Total Count: 2
Limit: 20
Offset: 0
+-------------+-----------+-----------+-------------------------------------+----------+-----------+----------------------------------+
| DataFile ID | Directory | Filename | URI | Verified | Size | MD5 Sum |
+=============+===========+===========+=====================================+==========+===========+==================================+
| 120 | | hello.txt | James Test Dataset 004-35/hello.txt | True | 25 bytes | 214e52fcf7f98d9fb8588b42cfb7987f |
+-------------+-----------+-----------+-------------------------------------+----------+-----------+----------------------------------+
| 121 | | test.txt | James Test Dataset 004-35/test.txt | False | 8 bytes | 74119cb1c9568b96feb7fa392006e40f |
+-------------+-----------+-----------+-------------------------------------+----------+-----------+----------------------------------+
Named Arguments¶
- --dataset
The dataset ID.
- --directory
The subdirectory within the dataset.
- --filename
The datafile’s name.
- --limit
Maximum number of results to return.
- --offset
Skip this many records from the start of the result set.
- --order_by
Order by this field.
- --json
Display results in JSON format.
Default: False
- --filter
Filter on these fields, e.g. “filename=file1.txt”.
get¶
Display a single datafile record.
mytardis datafile get [--json] datafile_id
EXAMPLE
$ mytardis datafile get 99
+----------------+-------------------------------------+
| DataFile field | Value |
+================+=====================================+
| ID | 99 |
+----------------+-------------------------------------+
| Dataset | /api/v1/dataset/31/ |
+----------------+-------------------------------------+
| Filename | hello.txt |
+----------------+-------------------------------------+
| URI | James Test Dataset 001-31/hello.txt |
+----------------+-------------------------------------+
| Verified | True |
+----------------+-------------------------------------+
| Size | 13 bytes |
+----------------+-------------------------------------+
| MD5 Sum | 9af2f8218b150c351ad802c6f3d66abe |
+----------------+-------------------------------------+
Positional Arguments¶
- datafile_id
The datafile ID.
Named Arguments¶
- --metadata
Include metadata.
Default: False
- --json
Display results in JSON format.
Default: False
create¶
Create a datafile record.
mytardis datafile create
[-s STORAGEBOX] [-d DATASET_PATH] dataset_id path
EXAMPLE
$ mytardis datafile create 31 dataset1/test.txt
Model: DataFile
+----------------+------------------------------------+
| DataFile field | Value |
+================+====================================+
| ID | 119 |
+----------------+------------------------------------+
| Dataset | /api/v1/dataset/31/ |
+----------------+------------------------------------+
| Storage Box | default |
+----------------+------------------------------------+
| Directory | |
+----------------+------------------------------------+
| Filename | test.txt |
+----------------+------------------------------------+
| URI | James Test Dataset 001-31/test.txt |
+----------------+------------------------------------+
| Verified | False |
+----------------+------------------------------------+
| Size | 5 bytes |
+----------------+------------------------------------+
| MD5 Sum | 2205e48de5f93c784733ffcca841d2b5 |
+----------------+------------------------------------+
Positional Arguments¶
- dataset_id
The dataset ID.
- path
The file to be represented in the datafile record, or a directory containing the datafiles to create records for.
Named Arguments¶
- -s, --storagebox
The storage box containing the datafile.
- -d, --dataset_path
The local dataset path.
download¶
Download a datafile.
mytardis datafile download datafile_id
EXAMPLE
$ mytardis datafile download 99
Downloaded: hello.txt
Positional Arguments¶
- datafile_id
The datafile ID.
upload¶
Upload a datafile.
mytardis datafile upload
[-s STORAGEBOX] [-d DATASET_PATH] dataset_id file_path
EXAMPLE
We will upload datafile "new_datafile.txt" to dataset ID 35:
$ mytardis datafile upload 35 new_datafile.txt
Uploaded: new_datafile.txt
Now let's display dataset 35 (including its datafiles) and
check whether our new datafile has been uploaded:
$ mytardis dataset get 35
+---------------+------------------------+
| Dataset field | Value |
+===============+========================+
| ID | 35 |
+---------------+------------------------+
| Experiment(s) | /api/v1/experiment/24/ |
+---------------+------------------------+
| Description | James Test Dataset 004 |
+---------------+------------------------+
| Instrument | None |
+---------------+------------------------+
+---------------------+---------------------+------------------------+-------------------------+-----------------+----------------+---------+
| DatasetParameter ID | Schema | Parameter Name | String Value | Numerical Value | Datetime Value | Link ID |
+=====================+=====================+========================+=========================+=================+================+=========+
| 1 | Test dataset schema | Example Parameter Name | Example Parameter Value | | | |
+---------------------+---------------------+------------------------+-------------------------+-----------------+----------------+---------+
Model: DataFile
Query: http://mytardisdemo.erc.monash.edu.au/api/v1/dataset_file/?format=json&dataset__id=35
Total Count: 3
Limit: 20
Offset: 0
+-------------+-----------+------------------+--------------------------------------------+----------+-----------+----------------------------------+
| DataFile ID | Directory | Filename | URI | Verified | Size | MD5 Sum |
+=============+===========+==================+============================================+==========+===========+==================================+
| 120 | | hello.txt | James Test Dataset 004-35/hello.txt | True | 25 bytes | 214e52fcf7f98d9fb8588b42cfb7987f |
+-------------+-----------+------------------+--------------------------------------------+----------+-----------+----------------------------------+
| 121 | | test.txt | James Test Dataset 004-35/test.txt | False | 8 bytes | 74119cb1c9568b96feb7fa392006e40f |
+-------------+-----------+------------------+--------------------------------------------+----------+-----------+----------------------------------+
| 131 | | new_datafile.txt | James Test Dataset 004-35/new_datafile.txt | True | 21 bytes | 2ce6aa694791def6de39b3fccead9d87 |
+-------------+-----------+------------------+--------------------------------------------+----------+-----------+----------------------------------+
Positional Arguments¶
- dataset_id
The dataset ID.
- file_path
The file to upload.
Named Arguments¶
- -s, --storagebox
The storage box which will store the datafile.
- -d, --dataset_path
The local dataset path.
update¶
Update a datafile record.
mytardis datafile update [--md5sum MD5SUM] datafile_id
EXAMPLE
$ mytardis datafile update --md5sum "md5-sum" 99
HTTP 401
Traceback (most recent call last):
...
Exception
Datafile updates are not yet enabled in the MyTardis API.
See the "update_detail" method in tardis/tardis_portal/api.py
Being able to update the MD5 sum would be useful for really
large datafiles where calculating the MD5 sum is time-consuming.
Rather than waiting until the MD5 sum calculation is complete to
begin a datafile upload, the datafile upload could begin
immediately (supplying a bogus MD5 sum to MyTardis), and then
the MD5 sum could be updated once the calculation is complete.
Positional Arguments¶
- datafile_id
The ID of the datafile to update.
Named Arguments¶
- --md5sum
The new MD5 sum of the datafile.