mytardis¶
Command-line interface for MyTardis REST API.
usage: mytardis [-h] [--verbose] [--version]
{api,config,version,facility,instrument,experiment,dataset,datafile,storagebox,schema}
...
Positional Arguments¶
- model
Possible choices: api, config, version, facility, instrument, experiment, dataset, datafile, storagebox, schema
available models
Named Arguments¶
- --verbose
More verbose output.
Default: False
- --version
Display version.
Default: False
Sub-commands:¶
api¶
List models accessible via MyTardis’s REST API.
See mytardis api
mytardis api [-h] {list,get} ...
Positional Arguments¶
- command
Possible choices: list, get
available commands
Sub-commands:¶
list¶
List models accessible via MyTardis’s REST API.
mytardis api list [-h] [--json]
EXAMPLE
$ mytardis api list
API Endpoints
+------------+---------------------+----------------------------+
| Model | List Endpoint | Schema |
+============+=====================+============================+
| facility | /api/v1/facility/ | /api/v1/facility/schema/ |
+------------+---------------------+----------------------------+
| instrument | /api/v1/instrument/ | /api/v1/instrument/schema/ |
+------------+---------------------+----------------------------+
| experiment | /api/v1/experiment/ | /api/v1/experiment/schema/ |
+------------+---------------------+----------------------------+
| dataset | /api/v1/dataset/ | /api/v1/dataset/schema/ |
+------------+---------------------+----------------------------+
... ... ...
+------------+---------------------+----------------------------+
Named Arguments¶
- --json
Display results in JSON format.
Default: False
get¶
Display the schema for a particular MyTardis API model, showing which fields are accesible via the API, which fields support filtering, and which fields support ordering.
mytardis api get [-h] [--json] api_model
EXAMPLE
$ mytardis api get facility
+------------------+------------------------------------------+
| API Schema field | Value |
+==================+==========================================+
| Model | facility |
+------------------+------------------------------------------+
| Fields | id |
| | manager_group |
| | name |
| | resource_uri |
+------------------+------------------------------------------+
| Filtering | { |
| | "id": [ |
| | "exact" |
| | ], |
| | "manager_group": "ALL_WITH_RELATIONS", |
| | "name": [ |
| | "exact" |
| | ] |
| | } |
+------------------+------------------------------------------+
| Ordering | {} |
+------------------+------------------------------------------+
Positional Arguments¶
- api_model
The model name.
Named Arguments¶
- --json
Display results in JSON format.
Default: False
config¶
Set MyTardis URL, username and API key.
See mytardis config
mytardis config [-h] [--get KEY]
EXAMPLE
$ mytardis config
MyTardis URL? http://mytardisdemo.erc.monash.edu.au
MyTardis Username? demofacility
MyTardis API key? 644be179cc6773c30fc471bad61b50c90897146c
Wrote settings to /Users/wettenhj/.config/mytardisclient/mytardisclient.cfg
$ mytardis config --get url
http://mytardisdemo.erc.monash.edu.au
$ mytardis config --get username
demofacility
$ mytardis config --get apikey
644be179cc6773c30fc471bad61b50c90897146c
$ mytardis config --get path
/Users/wettenhj/.config/mytardisclient/mytardisclient.cfg
$ mytardis config --get logging_config_path
/Users/wettenhj/.config/mytardisclient/logging.cfg
Named Arguments¶
- --get
Retrieve configuration value from ~/.config/mytardisclient/mytardisclient.cfg
version¶
Display the MyTardis Client version.
See mytardis version
mytardis version [-h]
$ mytardis version
MyTardis Client v0.0.1
facility¶
Display a list of facility records or a single facility record.
mytardis facility [-h] {list,get} ...
Positional Arguments¶
- command
Possible choices: list, get
available commands
Sub-commands:¶
list¶
Display a list of facility records.
mytardis facility list
[--limit LIMIT] [--offset OFFSET] [--order_by ORDER_BY] [--json]
EXAMPLE
$ mytardis facility list
Model: Facility
Query: http://mytardisdemo.erc.monash.edu.au/api/v1/facility/?format=json
Total Count: 2
Limit: 20
Offset: 0
+----+---------------+------------------------+
| ID | Name | Manager Group |
+====+===============+========================+
| 1 | Demo Facility | demo-facility-managers |
+----+---------------+------------------------+
| 2 | Test Facility | test-facility-managers |
+----+---------------+------------------------+
Named Arguments¶
- --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
get¶
Display a single facility record.
mytardis facility get [-h] [--json] facility_id
EXAMPLE
$ mytardis facility get 1
Model: Facility
+----------------+------------------------+
| Facility field | Value |
+================+========================+
| ID | 1 |
+----------------+------------------------+
| Name | Demo Facility |
+----------------+------------------------+
| Manager Group | demo-facility-managers |
+----------------+------------------------+
Model: Instrument
Query: http://mytardisdemo.erc.monash.edu.au/api/v1/instrument/?format=json&facility__id=1
Total Count: 3
Limit: 20
Offset: 0
+----+-------------------------+---------------+
| ID | Name | Facility |
+====+=========================+===============+
| 3 | Test Instrument | Demo Facility |
+----+-------------------------+---------------+
| 4 | Beamline | Demo Facility |
+----+-------------------------+---------------+
| 8 | James Test Instrument | Demo Facility |
+----+-------------------------+---------------+
Positional Arguments¶
- facility_id
The facility ID.
Named Arguments¶
- --json
Display results in JSON format.
Default: False
instrument¶
Display a list of instrument records or a single instrument record.
mytardis instrument [-h] {list,get,create,update} ...
Positional Arguments¶
- command
Possible choices: list, get, create, update
available commands
Sub-commands:¶
list¶
Display a list of instrument records.
mytardis instrument list
[--facility FACILITY] [--limit LIMIT] [--offset OFFSET] [--order_by ORDER_BY] [--json]
EXAMPLE
$ mytardis instrument list --facility 1
Model: Instrument
Query: http://mytardisdemo.erc.monash.edu.au/api/v1/instrument/?format=json&facility__id=1
Total Count: 3
Limit: 20
Offset: 0
+----+-------------------------+---------------+
| ID | Name | Facility |
+====+=========================+===============+
| 3 | Test Instrument | Demo Facility |
+----+-------------------------+---------------+
| 4 | Beamline | Demo Facility |
+----+-------------------------+---------------+
| 8 | James Test Instrument | Demo Facility |
+----+-------------------------+---------------+
Named Arguments¶
- --facility
The facility ID.
- --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
get¶
Display a single instrument record.
mytardis instrument get [-h] [--json] instrument_id
EXAMPLE
$ mytardis instrument get 3
+------------------+-----------------+
| Instrument field | Value |
+==================+=================+
| ID | 3 |
+------------------+-----------------+
| Name | Test Instrument |
+------------------+-----------------+
| Facility | Demo Facility |
+------------------+-----------------+
Positional Arguments¶
- instrument_id
The instrument ID.
Named Arguments¶
- --json
Display results in JSON format.
Default: False
create¶
Create an instrument record.
mytardis instrument create [-h] facility_id name
EXAMPLE
$ mytardis instrument create 1 "New Instrument"
+------------------+----------------+
| Instrument field | Value |
+==================+================+
| ID | 9 |
+------------------+----------------+
| Name | New Instrument |
+------------------+----------------+
| Facility | Demo Facility |
+------------------+----------------+
Instrument created successfully.
Positional Arguments¶
- facility_id
The ID of the new instrument’s facility.
- name
The name of the instrument to create.
update¶
Update/rename an existing instrument record.
mytardis instrument update [-h] [--name NAME] instrument_id
EXAMPLE
$ mytardis instrument update --name "Renamed New Instrument" 9
+------------------+------------------------+
| Instrument field | Value |
+==================+========================+
| ID | 9 |
+------------------+------------------------+
| Name | Renamed New Instrument |
+------------------+------------------------+
| Facility | Demo Facility |
+------------------+------------------------+
Instrument updated successfully.
Positional Arguments¶
- instrument_id
The ID of the instrument to update.
Named Arguments¶
- --name
The new name of the instrument.
experiment¶
Display a list of experiment records or a single experiment record.
mytardis experiment [-h] {list,get,create,update} ...
Positional Arguments¶
- command
Possible choices: list, get, create, update
available commands
Sub-commands:¶
list¶
Display a list of experiment records.
mytardis experiment list
[--limit LIMIT] [--offset OFFSET] [--order_by ORDER_BY] [--json]
[--filter FILTER]
EXAMPLE
$ mytardis experiment list
Model: Experiment
Query: http://mytardisdemo.erc.monash.edu.au/api/v1/experiment/?format=json
Total Count: 4
Limit: 20
Offset: 0
+----+-------------------+-----------------------------------+
| ID | Institution | Title |
+====+===================+===================================+
| 20 | Monash University | James Exp 001 |
+----+-------------------+-----------------------------------+
| 13 | Monash University | A's Test Instrument - Test User1 |
+----+-------------------+-----------------------------------+
| 22 | Monash University | James Test Exp 003 |
+----+-------------------+-----------------------------------+
| 14 | Monash University | A's Test Instrument - Test User2 |
+----+-------------------+-----------------------------------+
Named Arguments¶
- --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.
Default: “-created_time”
- --json
Display results in JSON format.
Default: False
- --filter
Filter on these fields, e.g. “title=Exp Title”.
get¶
Display a single experiment record.
mytardis experiment get [-h] [--json] experiment_id
EXAMPLE
$ mytardis experiment get 20
+------------------+-------------------+
| Experiment field | Value |
+==================+===================+
| ID | 20 |
+------------------+-------------------+
| Institution | Monash University |
+------------------+-------------------+
| Title | James Exp 001 |
+------------------+-------------------+
| Description | |
+------------------+-------------------+
+------------+------------------------+------------------------+------------+
| Dataset ID | Experiment(s) | Description | Instrument |
+============+========================+========================+============+
| 34 | /api/v1/experiment/20/ | James Test Dataset 001 | None |
+------------+------------------------+------------------------+------------+
| 33 | /api/v1/experiment/20/ | James Test Dataset 003 | None |
+------------+------------------------+------------------------+------------+
| 32 | /api/v1/experiment/20/ | James Test Dataset 002 | None |
+------------+------------------------+------------------------+------------+
| 31 | /api/v1/experiment/20/ | James Test Dataset 001 | None |
+------------+------------------------+------------------------+------------+
Positional Arguments¶
- experiment_id
The experiment ID.
Named Arguments¶
- --metadata
Include metadata.
Default: False
- --json
Display results in JSON format.
Default: False
create¶
Create an experiment record.
mytardis experiment create
[--description DESCRIPTION] [--institution INSTITUTION] [--params PARAMS] title
EXAMPLE
First let's look up an experiment schema we can use to add some
metadata to the new experiment record.
$ mytardis schema list
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| ID | Name | Namespace | Type | Subtype | Immutable | Hidden |
+====+===========================+===========================================================+===================+=========+===========+========+
... ... ... ... ... ... ...
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| 12 | Sample Experiment Schema | https://mytardis.org/schemas/sample-experiment-schema | Experiment schema | | False | False |
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
"mytardis schema get <schema_id>" displays the parameters
associated with this schema:
$ mytardis schema get 12
+--------------+-------------------------------------------------------+
| Schema field | Value |
+==============+=======================================================+
| ID | 12 |
+--------------+-------------------------------------------------------+
| Name | Sample Experiment Schema |
+--------------+-------------------------------------------------------+
| Namespace | https://mytardis.org/schemas/sample-experiment-schema |
+--------------+-------------------------------------------------------+
| Type | Experiment schema |
+--------------+-------------------------------------------------------+
| Subtype | |
+--------------+-------------------------------------------------------+
| Immutable | False |
+--------------+-------------------------------------------------------+
| Hidden | False |
+--------------+-------------------------------------------------------+
+------------------+-----------------------+-----------------------+-----------+-------+-----------+---------------+-------+---------+-----------------+
| ParameterName ID | Full Name | Name | Data Type | Units | Immutable | Is Searchable | Order | Choices | Comparison Type |
+==================+=======================+=======================+===========+=======+===========+===============+=======+=========+=================+
| 33 | Sample Parameter Name | sample_parameter_name | String | | False | False | 9999 | | Exact value |
+------------------+-----------------------+-----------------------+-----------+-------+-----------+---------------+-------+---------+-----------------+
Now that we know the schema's namespace, the parameter name(s) and
their data type(s), we can create some experiment metadata.
Below we use cat to create the metadata file, but you can use
any text editor.
$ cat << EOF > params.json
[
{
"schema": "https://mytardis.org/schemas/sample-experiment-schema",
"parameters": [
{
"name": "sample_parameter_name",
"value": "Sample Parameter Value"
}
]
}
]
EOF
Now we create the experiment record, using the metadata file
we just created:
$ mytardis experiment create --params params.json "Exp With Params"
+------------------+-------------------+
| Experiment field | Value |
+==================+===================+
| ID | 28 |
+------------------+-------------------+
| Institution | Monash University |
+------------------+-------------------+
| Title | Exp With Params |
+------------------+-------------------+
| Description | |
+------------------+-------------------+
+------------------------+--------------------------+-----------------------+------------------------+-----------------+----------------+---------+
| ExperimentParameter ID | Schema | Parameter Name | String Value | Numerical Value | Datetime Value | Link ID |
+========================+==========================+=======================+========================+=================+================+=========+
| 35 | Sample Experiment Schema | Sample Parameter Name | Sample Parameter Value | | | |
+------------------------+--------------------------+-----------------------+------------------------+-----------------+----------------+---------+
Experiment created successfully.
Positional Arguments¶
- title
The experiment title to create.
Named Arguments¶
- --description
A description of the experiment.
- --institution
The institution of the experiment.
- --params
A JSON file containing experiment parameters.
update¶
Update an experiment record.
mytardis experiment update
[--title TITLE] [--description DESCRIPTION] experiment_id
EXAMPLE
$ mytardis experiment update --title "Renamed Exp" 20
+------------------+-------------------+
| Experiment field | Value |
+==================+===================+
| ID | 20 |
+------------------+-------------------+
| Institution | Monash University |
+------------------+-------------------+
| Title | Renamed Exp |
+------------------+-------------------+
| Description | |
+------------------+-------------------+
Experiment updated successfully.
Positional Arguments¶
- experiment_id
The ID of the experiment to update.
Named Arguments¶
- --title
The new title of the experiment.
- --description
The new description of the experiment.
dataset¶
Display a list of dataset records or a single dataset record.
See mytardis dataset
mytardis dataset [-h] {list,get,create,update,download} ...
Positional Arguments¶
- command
Possible choices: list, get, create, update, download
available commands
Sub-commands:¶
list¶
Display a list of dataset records.
mytardis dataset list
[--exp EXP] [--limit LIMIT] [--offset OFFSET] [--order_by ORDER_BY] [--json]
[--filter FILTER]
EXAMPLE
$ mytardis dataset list --exp 20
Model: Dataset
Query: http://mytardisdemo.erc.monash.edu.au/api/v1/dataset/?format=json&experiments__id=20
Total Count: 4
Limit: 20
Offset: 0
+------------+------------------------+------------------------+------------+
| Dataset ID | Experiment(s) | Description | Instrument |
+============+========================+========================+============+
| 34 | /api/v1/experiment/20/ | James Test Dataset 001 | None |
+------------+------------------------+------------------------+------------+
| 33 | /api/v1/experiment/20/ | James Test Dataset 003 | None |
+------------+------------------------+------------------------+------------+
| 32 | /api/v1/experiment/20/ | James Test Dataset 002 | None |
+------------+------------------------+------------------------+------------+
| 31 | /api/v1/experiment/20/ | James Test Dataset 001 | None |
+------------+------------------------+------------------------+------------+
Named Arguments¶
- --exp
The experiment ID.
- --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. “description=Dataset Description”.
get¶
Display a single dataset record.
mytardis dataset get [-h] [--json] dataset_id
EXAMPLE
Suppose we want to retrieve a dataset record with dataset_id=35.
The "mytardis dataset get 35" command will also display any
dataset parameters associated with the dataset and any
datafiles associated with it. The datafile query could result
in pagination. If "Total Count" (below) is greater
than "Limit", then there are additional pages of datafiles
not shown in the dataset view below.
$ 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: 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 |
+--------------+-----------+-----------+-------------------------------------+----------+-----------+----------------------------------+
Positional Arguments¶
- dataset_id
The dataset ID.
Named Arguments¶
- --metadata
Include metadata.
Default: False
- --json
Display results in JSON format.
Default: False
create¶
Create a dataset record.
mytardis dataset create
[--instrument INSTRUMENT] [--params PARAMS] experiment_id description
EXAMPLE
First let's look up a dataset schema we can use to add some
metadata to the new experiment record.
$ mytardis schema list
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| ID | Name | Namespace | Type | Subtype | Immutable | Hidden |
+====+===========================+===========================================================+===================+=========+===========+========+
... ... ... ... ... ... ...
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| 13 | Sample Dataset Schema | https://mytardis.org/schemas/sample-dataset-schema | Dataset schema | | False | False |
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
"mytardis schema get <schema_id>" displays the parameters
associated with this schema:
$ mytardis schema get 13
+--------------+----------------------------------------------------+
| Schema field | Value |
+==============+====================================================+
| ID | 13 |
+--------------+----------------------------------------------------+
| Name | Sample Dataset Schema |
+--------------+----------------------------------------------------+
| Namespace | https://mytardis.org/schemas/sample-dataset-schema |
+--------------+----------------------------------------------------+
| Type | Dataset schema |
+--------------+----------------------------------------------------+
| Subtype | |
+--------------+----------------------------------------------------+
| Immutable | False |
+--------------+----------------------------------------------------+
| Hidden | False |
+--------------+----------------------------------------------------+
+------------------+-----------------------+-----------------------+-----------+-------+-----------+---------------+-------+---------+-----------------+
| ParameterName ID | Full Name | Name | Data Type | Units | Immutable | Is Searchable | Order | Choices | Comparison Type |
+==================+=======================+=======================+===========+=======+===========+===============+=======+=========+=================+
| 34 | Sample Parameter Name | sample_parameter_name | String | | False | False | 9999 | | Exact value |
+------------------+-----------------------+-----------------------+-----------+-------+-----------+---------------+-------+---------+-----------------+
Now that we know the schema's namespace, the parameter name(s) and
their data type(s), we can create some dataset metadata.
Below we use cat to create the metadata file, but you can use
any text editor.
$ cat << EOF > params.json
[
{
"schema": "https://mytardis.org/schemas/sample-dataset-schema",
"parameters": [
{
"name": "sample_parameter_name",
"value": "Sample Parameter Value"
}
]
}
]
EOF
Now we create the dataset record (and associate it with experiment
ID 20) , using the metadata file we just created:
$ mytardis dataset create --params params.json 20 "Dataset With Params"
+---------------+------------------------+
| Dataset field | Value |
+===============+========================+
| ID | 39 |
+---------------+------------------------+
| Experiment(s) | /api/v1/experiment/20/ |
+---------------+------------------------+
| Description | Dataset With Params |
+---------------+------------------------+
| Instrument | None |
+---------------+------------------------+
+---------------------+-----------------------+-----------------------+------------------------+-----------------+----------------+---------+
| DatasetParameter ID | Schema | Parameter Name | String Value | Numerical Value | Datetime Value | Link ID |
+=====================+=======================+=======================+========================+=================+================+=========+
| 3 | Sample Dataset Schema | Sample Parameter Name | Sample Parameter Value | | | |
+---------------------+-----------------------+-----------------------+------------------------+-----------------+----------------+---------+
Dataset created successfully.
Positional Arguments¶
- experiment_id
The experiment ID.
- description
The dataset description.
Named Arguments¶
- --instrument
The instrument ID.
- --params
A JSON file containing dataset parameters.
update¶
Update a dataset record.
mytardis dataset update
[--description DESCRIPTION] dataset_id
EXAMPLE
$ mytardis dataset update --description "Renamed Dataset" 39
HTTP 401
Traceback (most recent call last):
...
Exception
Dataset updates are not yet enabled in the MyTardis API.
See the "update_detail" method in tardis/tardis_portal/api.py
Positional Arguments¶
- dataset_id
The ID of the dataset to update.
Named Arguments¶
- --description
The new description of the dataset.
datafile¶
Display a list of datafile records or a single datafile record.
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.
storagebox¶
Display a list of storage box records or a single storage box record.
mytardis storagebox [-h] {list,get} ...
Positional Arguments¶
- command
Possible choices: list, get
available commands
Sub-commands:¶
list¶
Display a list of storage box records.
mytardis storagebox list
[--limit LIMIT] [--offset OFFSET] [--order_by ORDER_BY] [--json]
EXAMPLE
$ mytardis storagebox list
Model: StorageBox
Query: http://mytardisdemo.erc.monash.edu.au/api/v1/storagebox/?format=json
Total Count: 2
Limit: 20
Offset: 0
+----+------------------------------------------------+-----------------+
| ID | Name | Description |
+====+================================================+=================+
| 1 | local box at /opt/mytardis/develop/var/store | Default Storage |
+----+------------------------------------------------+-----------------+
| 2 | local box at /opt/mytardis/develop/var/staging | Default Staging |
+----+------------------------------------------------+-----------------+
Named Arguments¶
- --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
get¶
Display a single storage box record.
mytardis storagebox get [-h] [--json] storage_box_id
EXAMPLE
$ mytardis storagebox get 2
+----------------------+-------------------------------------------------------------+
| StorageBox field | Value |
+======================+=============================================================+
| ID | 2 |
+----------------------+-------------------------------------------------------------+
| Name | local box at /opt/mytardis/develop/var/staging |
+----------------------+-------------------------------------------------------------+
| Description | Default Staging |
+----------------------+-------------------------------------------------------------+
| Django Storage Class | tardis.tardis_portal.storage.MyTardisLocalFileSystemStorage |
+----------------------+-------------------------------------------------------------+
| Max Size | 2.842e+10 |
+----------------------+-------------------------------------------------------------+
| Status | dirty |
+----------------------+-------------------------------------------------------------+
+----------------------+-----------------------------------+
| StorageBoxOption Key | StorageBoxOption Value |
+======================+===================================+
| location | /opt/mytardis/develop/var/staging |
+----------------------+-----------------------------------+
+-------------------------+--------------------------------+
| StorageBoxAttribute Key | StorageBoxAttribute Value |
+=========================+================================+
| scp_username | mydata |
+-------------------------+--------------------------------+
| scp_hostname | mytardisdemo.erc.monash.edu.au |
+-------------------------+--------------------------------+
Positional Arguments¶
- storage_box_id
The storage box ID.
Named Arguments¶
- --json
Display results in JSON format.
Default: False
schema¶
Display a list of schema records or a single schema record.
See mytardis schema
mytardis schema [-h] {list,get} ...
Positional Arguments¶
- command
Possible choices: list, get
available commands
Sub-commands:¶
list¶
Display a list of schema records.
mytardis schema list
[--limit LIMIT] [--offset OFFSET] [--order_by ORDER_BY] [--json]
EXAMPLE
$ mytardis schema list
Model: Schema
Query: http://mytardisdemo.erc.monash.edu.au/api/v1/schema/?format=json
Total Count: 13
Limit: 20
Offset: 0
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| ID | Name | Namespace | Type | Subtype | Immutable | Hidden |
+====+===========================+===========================================================+===================+=========+===========+========+
| 1 | Publication | http://www.tardis.edu.au/schemas/publication/ | Experiment schema | | True | True |
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| 2 | Draft Publication | http://www.tardis.edu.au/schemas/publication/draft/ | Experiment schema | | True | True |
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| 3 | Publication Details | http://www.tardis.edu.au/schemas/publication/details/ | Experiment schema | | True | False |
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| 8 | MyData Default Experiment | http://mytardis.org/schemas/mydata/defaultexperiment | Experiment schema | | True | True |
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| 13 | Sample Dataset Schema | https://mytardis.org/schemas/sample-dataset-schema | Dataset schema | | False | False |
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| 12 | Sample Experiment Schema | https://mytardis.org/schemas/sample-experiment-schema | Experiment schema | | False | False |
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
Named Arguments¶
- --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
get¶
Display a single schema record.
mytardis schema get [--params] [--json] schema_id
EXAMPLE
$ mytardis schema get 12
+--------------+-------------------------------------------------------+
| Schema field | Value |
+==============+=======================================================+
| ID | 12 |
+--------------+-------------------------------------------------------+
| Name | Sample Experiment Schema |
+--------------+-------------------------------------------------------+
| Namespace | https://mytardis.org/schemas/sample-experiment-schema |
+--------------+-------------------------------------------------------+
| Type | Experiment schema |
+--------------+-------------------------------------------------------+
| Subtype | |
+--------------+-------------------------------------------------------+
| Immutable | False |
+--------------+-------------------------------------------------------+
| Hidden | False |
+--------------+-------------------------------------------------------+
+------------------+-----------------------+-----------------------+-----------+-------+-----------+---------------+-------+---------+-----------------+
| ParameterName ID | Full Name | Name | Data Type | Units | Immutable | Is Searchable | Order | Choices | Comparison Type |
+==================+=======================+=======================+===========+=======+===========+===============+=======+=========+=================+
| 33 | Sample Parameter Name | sample_parameter_name | String | | False | False | 9999 | | Exact value |
+------------------+-----------------------+-----------------------+-----------+-------+-----------+---------------+-------+---------+-----------------+
Positional Arguments¶
- schema_id
The schema ID.
Named Arguments¶
- --params
Display parameter names.
Default: False
- --json
Display results in JSON format.
Default: False