Changes for page Working with HDC Project Files in the Command Line Interface
Last modified by Dennis Segebarth on 2024/10/02 18:38
To version 9.1
edited by Dennis Segebarth
on 2023/09/13 18:09
on 2023/09/13 18:09
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.sge vans1 +XWiki.dsegebarth - Content
-
... ... @@ -1,3 +1,7 @@ 1 +{{box cssClass="floatinginfobox" title="Table of Contents"}} 2 +{{toc depth="2"/}} 3 +{{/box}} 4 + 1 1 The Pilot Command Line Interface (pilotcli) is a binary executable program that provides a convenient way for users to perform file actions and platform-related tasks programmatically. The Pilot Command Line Interface can be downloaded and run on on your local Linux and Linux subsystems (as Windows user, see for instance the [[Windows Subsystem for Linux installation guide>>url:https://learn.microsoft.com/en-us/windows/wsl/install]]) to support large file uploads. For convenience, pilotcli is also pre-deployed and installed in the users JupyterHub accessible via worskpace tools. 2 2 3 3 = Data Stewardship = ... ... @@ -8,6 +8,10 @@ 8 8 9 9 To get started with the Pilot Command Line Interface in the HDC JupyterHub workspace tool, see the article //Using JupyterHub in HDC //and refer to the remaining sections in this article for a full description of the pilotcli commands. 10 10 15 += Using the Pilot Command Line Interface in Guacamole VMs = 16 + 17 +To get started with the Pilot Command Line Interface in the HDC Guacamole workspace tool, see //Using Guacamole in HDC// on how to launch a terminal, either in a Desktop VM or directly by establishing a connection to a Command Line VM. The Pilot Command Line Interface will be installed, configured, and ready to be used. Please refer to the remaining sections in this article for a full description of the pilotcli commands. 18 + 11 11 = Downloading the Pilot Command Line Interface = 12 12 13 13 If you wish to use the Pilot Command Line Interface to upload large files from your local environment, it is necessary to download Pilot Command Line Interface tool on your Linux system. The recommended Linux version is Ubuntu 20.04. ... ... @@ -102,7 +102,7 @@ 102 102 103 103 3) Device Login Successful message will appear and your authentication browser window can be closed. 104 104 105 -4) The output of the Command Line Tool will also be updated (see line 14 below)to notify you about the successful login:113 +4) The output of the Command Line Tool will also be updated to notify you about the successful login: 106 106 107 107 {{code language="none"}} 108 108 $ pilotcli user login ... ... @@ -338,7 +338,7 @@ 338 338 339 339 * User login is required, otherwise an error is returned: "The current login session is invalid. Please login to continue." 340 340 * Project must be accessible to the user, otherwise an error is returned: "Project Code not found in list. Please verify and try again." 341 -* Requires the Project code, which can be retrieved via pilotcli project list. 349 +* Requires the Project code, which can be retrieved via {{code}}pilotcli project list{{/code}}. 342 342 * Requires the Attribute template name. If the attribute template name does not exist or is spelled incorrectly, an error is returned: "Attribute 'sample-template' not found in Project. Please verify and try again." 343 343 * pilotcli must have the permission to write a file in the directory, otherwise an error is returned. 344 344 ))) ... ... @@ -406,7 +406,7 @@ 406 406 407 407 * User login is required, otherwise an error is returned: "The current login session is invalid. Please login to continue." 408 408 * Project must be accessible to the user, otherwise an error is returned: "Project Code not found in list. Please verify and try again." 409 -* Requires the Project code, which can be retrieved via pilotcli project list. 417 +* Requires the Project code, which can be retrieved via {{code}}pilotcli project list{{/code}}. 410 410 ))) 411 411 412 412 {{code language="none"}} ... ... @@ -584,20 +584,308 @@ 584 584 Upload a file with tags and/or attributes. 585 585 586 586 * When entering the upload command, the user can add a maximum of ten tags to the file. For example, in order to add “sample_tag1” and “sample_tag2” to your file, simply add {{code}}-t sample_tag1{{/code}} {{code}}-t sample_tag2{{/code}} to the command (see example below using {{code}}tag1{{/code}} and {{code}}tag2{{/code}} as tags). 587 -* In addition, you can also use attribute templates for a more enriched annotation of your files. Please note, that the corresponding attribute template file needs to be edited & saved prior to uploading. To get the blank template, see the **attribute-export** instructions above for more details. To attach a attribute JSON-file to your file upon uploading, use -a cli_Manifest1_template.json, where “cli_Manifest1_template.json" points to the location of the attributes JSON-file on your local machine. 595 +* In addition, you can also use attribute templates for a more enriched annotation of your files. Please note, that the corresponding attribute template file needs to be edited & saved prior to uploading. To get the blank template, see the **attribute-export** instructions above for more details. To attach a attribute JSON-file to your file upon uploading, use {{code}}-a cli_Manifest1_template.json{{/code}}, where “{{code}}cli_Manifest1_template.json{{/code}}" points to the location of the attributes JSON-file on your local machine. 588 588 * Upon uploading, pilotcli will also validate the content of the attached attribute JSON-file. Whenever a template is invalid, including missing non-optional fields, non-existing choice in multiple choice attribute, exceeding length text field and so on, pilotcli will raise error to user and user must update the attribute template and upload again: 589 589 598 +{{code language="none"}} 599 +$ pilotcli file upload ./sample_folder/sample_file6 -p cli/admin -t tag1 -t tag2 -a cli_Manifest1_template.json 600 +File attribute validation passed: True 601 +Starting upload of: ./sample_folder/sample_file6 602 +Pre-upload complete. 603 +uploader: admin container_id: 18061 total_size: 1048576 total_chunks: 1 uniq_identifier: bc47ec2a-1a4e-4f71-a37a-7ce6473e415a-1627499273 resumable_relative_path admin/ 604 + 605 +Upload job is finalizing, please wait... 606 +Upload job complete. 607 +Attribute attached 608 +All files uploaded successfully. 609 +{{/code}} 590 590 611 +Upload a file with specified number of threads, using the {{code}}-td <thread_number>{{/code}} option. 591 591 613 +* By default, the number of threads is 1. There will no UI difference when using threads. The maximal number of threads depends on your local machine and the recommend thread number is 3: 592 592 593 ----- 615 +{{code language="none"}} 616 +$ pilotcli file upload -p indoctestproject/admin/test20230306_3 /home/color/indoc/script/large_folder_test_data/gentoo_root_100M.img -td 3 617 +Target folder does not exist. Would you like to create a new folder? [y/N]: y 618 +Starting upload of: /home/color/indoc/script/large_folder_test_data/gentoo_root_100M.img 619 +Pre-upload complete. 620 +Uploading gentoo_root_100M.img , resumable_id: c68752372b42c85d, job_id: 56de3632-58df-445c-bcb9-bddfe6be5bf7: |██████████████████████████████ 100% 00:00 621 +Upload Time: 79.77s for 1 files 622 +All uploading jobs have finished. 623 +{{/code}} 594 594 595 -- 596 -{{code language="none"}}{{/code}} 625 +Upload with customized manifest name 597 597 627 +When you upload a file using pilotcli, a JSON file with the details of your specific upload job will be created automatically and allows you to resume the upload at a later time, in case the process is aborted due to any reason. By default, this JSON file will be created as “manifest.json” in the current working directory (see //Command: **resume**// below for more details on how to resume the file upload). However, you can use the {{code}}--output-path{{/code}} option to specify the filepath and, thus, the filename of this JSON file: 628 + 629 +{{code language="none"}} 630 +$ pilotcli file upload -p <path> <file> --output-path test_manifest.json 631 +{{/code}} 632 + 633 +== Command: **resume** == 634 + 635 +* **Options**: -td ~-~-thread, -r ~-~-resumable-manifest 636 +* **Usage**: Resume unfinished file uploading based on the manifest file. 637 +* ((( 638 +**Prerequisite**: 639 + 640 +* User login is required, otherwise an error is returned: "The current login session is invalid. Please login to continue." 641 +* Project must be accessible to the user, otherwise an error is returned: "Project Code not found in list. Please verify and try again." 642 +* The resumable manifest JSON file is required, which is generated upon executing the {{code}}pilotcli file upload{{/code}} command. 643 +))) 644 + 645 +=== Example: === 646 + 647 +For instance upon disconnecting from the internet, or by accidentally closing the terminal, a currently running uploading process can be aborted. You can use the {{code}}pilotcli file resume{{/code}} command in order to resume the uploading process right where you left off. Simply point to the manifest JSON file that was created upon executing the original upload command. Please note that the source files still have to be in the same location, otherwise resuming the uploading process will fail. 648 + 649 +{{code language="none"}} 650 +$ pilotcli file resume -r ./manifest.json 651 +Resume the upload for 10 files. 652 +Resumable upload check complete. 653 +Uploading aggregated.py: |██████████████████████████████ 100% 00:00 654 +Uploading __init__.py: |██████████████████████████████ 100% 00:00 655 +Uploading service_meta_class.py: |██████████████████████████████ 100% 00:00 656 +Uploading upload_form.py: |██████████████████████████████ 100% 00:00 657 +Uploading convert_type.py: |██████████████████████████████ 100% 00:00 658 +Uploading singleton.py: |██████████████████████████████ 100% 00:00 659 +Uploading __init__.py: |██████████████████████████████ 100% 00:00 660 +Uploading base_library.zip: |██████████████████████████████ 100% 00:00 0% ? 661 +Uploading EXE-00.toc: |██████████████████████████████ 100% 00:00 662 +Uploading xref-pilotcli_test20230227_3.html: |██████████████████████████████ 100% 00:00 663 +Upload Time: 11.13s for 10 files 664 +{{/code}} 665 + 666 +== Command: **sync** == 667 + 668 +* **Usage**: Download a file or a folder from a Project. If pilotcli is used outside of the Platform, e.g. the users local machine, users can only download from Project’s Core. When pilotcli is used within the Platform, e.g. from one of the workspace tools, users will also be able to download from the Green Room of a Project as well. 669 +* ((( 670 +**Options**: -z ~-~-zone, -i ~-~-geid, ~-~-zip 671 + 672 +* To look up a file’s geid, or unique file ID, open the Project File Explorer in the Portal and inspect the File Properties for the ID. 673 +))) 674 +* ((( 675 +**Prerequisite**: 676 + 677 +* User login is required, otherwise an error is returned: "The current login session is invalid. Please login to continue." 678 +* The specified file or folder must exist, otherwise an error is returned: “File does not exist or source file provided is invalid: folder_name/file_name.” 679 +* If the user has no access to the specified file or folder on the Portal, an error is returned: “Permission denied. Please verify that your role in the Project has permission to perform this action.” 680 +))) 681 + 682 +{{code language="none"}} 683 +$ pilotcli file sync --help 684 +Usage: pilotcli file sync [OPTIONS] [PATHS]... OUTPUT_PATH 685 + 686 + Download files/folders from a given Project/folder/file in core zone. 687 + 688 +Options: 689 + -z, --zone TEXT Target Zone (i.e., core/greenroom) 690 + --zip Download files as a zip. 691 + -i, --geid Enable downloading by geid. 692 + --help Show this message and exit. 693 +{{/code}} 694 + 695 +=== Examples === 696 + 697 +Download a file or a folder from the Core zone of a Project: 698 + 699 +{{code language="none"}} 700 +$ pilotcli file sync cli/admin/sample_file2 -z core ~/Downloads/ 701 +Preparing status: READY_FOR_DOWNLOADING 702 +start downloading... 703 +Downloading sample_file2 |██████████████████████████████ 100% 00:00 704 +File has been downloaded successfully and saved to: /home/uname/Downloads/sample_file2 705 +{{/code}} 706 + 707 +Download multiple files or folders as a compressed zip by simply providing all source files or folders and adding the {{code}}--zip{{/code}} option: 708 + 709 +{{code language="none"}} 710 +$ pilotcli file sync cli/admin/sample_file2 cli/admin/sample_file7 -z core ~/Downloads/ --zip 711 +Preparing downloading 712 +Preparing status: READY_FOR_DOWNLOADING 713 +start downloading... 714 +Downloading cli_1632340658.768384.zip |██████████████████████████████ 100% 00:00 715 +File has been downloaded successfully and saved to: /home/uname/Downloads/cli_1632340658.768384.zip 716 +{{/code}} 717 + 718 +Download files or folders by their geid, instead of their location. To enable this, add {{code}}-i{{/code}} or {{code}}--geid{{/code}} to the command: 719 + 720 +{{code language="none"}} 721 +$ pilotcli file sync -i 6d89afd4-f86e-4df7-b6c5-01a9af4e828e-1627499957 7e8e2bac-97c6-4738-bc08-12139c9ba225-1627498854 ~/Downloads/ 722 +Preparing status: READY_FOR_DOWNLOADING 723 +start downloading... 724 +Downloading sample_file7 |██████████████████████████████ 100% 00:00 725 +File has been downloaded successfully and saved to: /home/uname/Downloads/sample_file7 726 +Preparing status: READY_FOR_DOWNLOADING 727 +start downloading... 728 +Downloading sample_file2 |██████████████████████████████ 100% 00:00 729 +File has been downloaded successfully and saved to: /home/uname/Downloads/sample_file2 730 +{{/code}} 731 + 732 +Download a file or folder from the Green Room of a Project. This will only be possible if pilotcli is used within the Platform, e.g. in one of the Workspace tools. It works the same way as downloading from Core, including all the additional options like zipping, by either adding {{code}}-z greenroom{{/code}} or by omitting the {{code}}-z{{/code}} option entirely, as “greenroom” is the default value: 733 + 734 +{{code language="none"}} 735 +$ pilotcli file sync cli/admin/sample_file2 cli/admin/sample_file7 ~/Downloads 736 +Preparing status: READY_FOR_DOWNLOADING 737 +/home/uname/Downloads/sample_file2 already exist, file will be saved as /home/uname/Downloads/sample_file2 (1) 738 +start downloading... 739 +Downloading sample_file2 (1) |██████████████████████████████ 100% 00:00 740 +File has been downloaded successfully and saved to: /home/uname/Downloads/sample_file2 (1) 741 +Preparing status: READY_FOR_DOWNLOADING 742 +start downloading... 743 +Downloading sample_file7 |██████████████████████████████ 100% 00:00 744 +File has been downloaded successfully and saved to: /home/uname/Downloads/sample_file7 745 +{{/code}} 746 + 747 += Dataset Commands: pilotcli **dataset** = 748 + 749 +== Help == 750 + 751 +{{code language="none"}} 752 +$ pilotcli dataset --help 753 +Usage: pilotcli dataset [OPTIONS] COMMAND [ARGS]... 754 + 755 +Options: 756 + --help Show this message and exit. 757 + 758 +Commands: 759 + download Download a dataset or a particular version of a dataset. 760 + list List datasets belonging to logged in user. 761 + show-detail Show details of a dataset. 762 +{{/code}} 763 + 764 +== Command: **list** == 765 + 766 +* **Usage**: List all datasets for the logged in user 767 +* ((( 768 +**Prerequisite**: 769 + 770 +* User login is required, otherwise an error is returned: "The current login session is invalid. Please login to continue." 771 +))) 772 + 773 +{{code language="none"}} 774 +$ pilotcli dataset list --help 775 +Usage: pilotcli dataset list [OPTIONS] 776 + 777 + List datasets belonging to logged in user. 778 + 779 +Options: 780 + --page INTEGER The page to be listed [default: 0] 781 + --page-size INTEGER number of objects per page [default: 10] 782 + -d, --detached whether run in detached mode 783 + --help Show this message and exit. 784 +{{/code}} 785 + 786 +=== Examples === 787 + 788 +List all datasets that are accessible for the user: 789 + 790 +{{code language="none"}} 791 +$ pilotcli dataset list 792 + Dataset Title Dataset Code 793 +--------------------------------------------------------------------------- 794 + dataset2 aug24202102 795 + dataset-01 aug242021 796 +Page: 0, Number of datasets: 2 797 +{{/code}} 798 + 799 +== Command: **show-detail** == 800 + 801 +* **Usage**: Show the detailed information of a dataset. 802 +* ((( 803 +**Prerequisite**: 804 + 805 +* User login is required, otherwise an error is returned: "The current login session is invalid. Please login to continue." 806 +))) 807 + 808 +{{code language="none"}} 809 +$ pilotcli dataset show-detail --help 810 +Usage: pilotcli dataset show-detail [OPTIONS] CODE 811 + 812 + Show details of a dataset. 813 + 814 +Options: 815 + --page INTEGER The page to be listed [default: 0] 816 + --page-size INTEGER number of objects per page [default: 10] 817 + -d, --detached whether run in detached mode 818 + --help Show this message and exit. 819 +{{/code}} 820 + 821 +=== Examples === 822 + 823 +Show the details of the specified Dataset by providing the unique Dataset Code - “aug242021” in this case: 824 + 825 +{{code language="none"}} 826 +$ pilotcli dataset show-detail aug242021 827 +-------------------------------------------------------------------------------- 828 +| Title | dataset-01 | 829 +-------------------------------------------------------------------------------- 830 +| Code | aug242021 | 831 +-------------------------------------------------------------------------------- 832 +| Authors | uname, cli | 833 +-------------------------------------------------------------------------------- 834 +| Type | GENERAL | 835 +-------------------------------------------------------------------------------- 836 +| Modality | neuroimaging, microscopy, histological approach | 837 +-------------------------------------------------------------------------------- 838 +| Collection_method | import, test, upload | 839 +-------------------------------------------------------------------------------- 840 +| Tags | tag1, tag2, tag3 | 841 +-------------------------------------------------------------------------------- 842 +| Versions | 1.0, 1.1, 1.2 | 843 +-------------------------------------------------------------------------------- 844 +{{/code}} 845 + 846 +== Command: **download** == 847 + 848 +* **Usage**: Download a particular version of a dataset. 849 +* **Options**: -v ~-~-version 850 +* ((( 851 +**Prerequisite**: 852 + 853 +* User login is required, otherwise error is returned: "The current login session is invalid. Please login to continue." 854 +))) 855 + 856 +{{code language="none"}} 857 +$ pilotcli dataset download --help 858 +Usage: pilotcli dataset download [OPTIONS] [CODE]... OUTPUT_PATH 859 + 860 + Download a dataset or a particular version of a dataset. 861 + 862 +Options: 863 + -v, --version TEXT Download a particular version of a dataset. 864 + --help Show this message and exit. 865 +{{/code}} 866 + 867 + 868 +=== Examples === 869 + 870 +Download a Dataset with Code “aug242021”: 871 + 872 +{{code language="none"}} 873 +$ pilotcli dataset download aug242021 ~/Downloads/ 874 +Pre downloading dataset 875 +Preparing status: READY_FOR_DOWNLOADING 876 +start downloading... 877 +Downloading aug242021_1632342868.882398.zip |██████████████████████████████ 100% 00:00 878 +File has been downloaded successfully and saved to: /home/uname/Downloads/aug242021_163234 879 +2868.882398.zip 880 +{{/code}} 881 + 882 +Download the version 1.1 of a Dataset with Code “aug242021”: 883 + 884 +{{code language="none"}} 885 +$ pilotcli dataset download aug242021 ~/Downloads/ -v 1.1 886 +Current dataset version: 1.1 887 +Pre downloading dataset 888 +start downloading... 889 +Downloading aug242021_2021-08-24 11:10:00.042277.zip |██████████████████████████████ 100% 00:00 890 +File has been downloaded successfully and saved to: /home/uname/Downloads/aug242021_2021-08-24 11:10:00.042277.zip 891 +{{/code}} 892 + 893 + 894 + 598 598 ---- 599 599 600 -Copyright © 2023 [[Indoc Research>>url:https://www.indocresearch.org/]].897 +Copyright © 2023 [[Indoc Systems>>url:https://www.indocsystems.com]]. 601 601 602 -HealthDataCloud is powered by Pilot technology, a product of [[Indoc Research>>url:https://www.indocresearch.org/]].~{~{/code}} 603 -~)~)~) 899 +HealthDataCloud is powered by Pilot technology, a product of [[Indoc Systems>>url:https://www.indocsystems.com]].