Changes for page Working with HDC Project Files in the Command Line Interface
Last modified by Dennis Segebarth on 2024/10/02 18:38
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -511,10 +511,216 @@ 511 511 512 512 In order to upload a file (or folder) to a destination directory in a Project's Core, core must be specified as corresponding zone {{code}}(-z core){{/code}} and you will be required to provide a message to that should describe the files` content and why you are uploading it directly into the Core {{code}}(-m "sample message"){{/code}}. Moreover, you will be reminded about the Terms of Use of the Platform and additional considerations regarding the direct upload of data into the Core zone, and are prompted to confirm your intention to proceed with the upload by entering “y” or “Yes”: 513 513 514 +{{code language="none"}} 515 +$ pilotcli file upload ./sample_folder/sample_file2 -p cli/admin -z core -m "sample message" 516 +You are about to transfer data directly to the Core! In accordance with the Terms of Use, please confirm that you 517 +have made your best efforts to pseudonymize or anonymize the data and that you have the legal authority to transfer and make this 518 +data available for dissemination and use within the Platform.To review the Terms of Use, please the Portal. If you 519 +need to process the data to remove sensitive identifiers, please cancel this transfer and upload the data to the Green Room to 520 +perform these actions. 521 +To cancel this transfer, enter [n/No] 522 +To confirm and proceed with the data transfer, enter [y/Yes] 523 + [y/N]: y 524 +Starting upload of: ./sample_folder/sample_file2 525 +Pre-upload complete. 526 +uploader: admin container_id: 18061 total_size: 1048576 total_chunks: 1 uniq_identifier: fa807a0f-ceb0-4fff-9c9e-563bdcbb309f-1627498851 resumable_relative_path admin/ 527 + 528 +Upload job is finalizing, please wait... 529 +Upload job complete. 530 +All files uploaded successfully. 531 +{{/code}} 514 514 533 +Upload a folder to Project Green Room 515 515 535 +{{code language="none"}} 536 +$ pilotcli file upload ./sample_folder/example_folder -p cli/admin 537 +Starting upload of: ./sample_folder/example_folder 538 +Current version does not support folder tagging, any selected tags will be ignored 539 +Pre-upload complete. 540 +uploader: admin container_id: 18061 total_size: 1048576 total_chunks: 1 uniq_identifier: 4f0eee2e-70f4-4b03-9e72-040544ec7d3a-1627498907 resumable_relative_path admin/example_folder/ 541 + 542 +Starting finalization... 543 +uploader: admin container_id: 18061 total_size: 1048576 total_chunks: 1 uniq_identifier: 41ec70e2-0859-4aba-9009-06e700c7c79e-1627498907 resumable_relative_path admin/example_folder/ 544 + 545 +Starting finalization... 546 +uploader: admin container_id: 18061 total_size: 1048576 total_chunks: 1 uniq_identifier: 28454c51-ec9a-4dc5-ab3c-0f7e80e3050d-1627498907 resumable_relative_path admin/example_folder/ 547 + 548 +Upload job is finalizing, please wait... 549 +Upload job complete. 550 +All files uploaded successfully. 551 +{{/code}} 516 516 553 +Upload file to existing folder in Green Room 517 517 555 +* Specify a target folder to upload files by inputting folder name after the Project code separated by the '/'. 556 + 557 +{{code language="none"}} 558 +$ pilotcli file upload ./sample_folder/sample_file5 -p cli/admin/example_folder 559 +Starting upload of: ./sample_folder/sample_file5 560 +Pre-upload complete. 561 +uploader: admin container_id: 18061 total_size: 1048576 total_chunks: 1 uniq_identifier: 7ef58005-d408-4ad9-a741-fa938f58e67f-1627498977 resumable_relative_path admin/example_folder/ 562 + 563 +Upload job is finalizing, please wait... 564 +Upload job complete. 565 +All files uploaded successfully. 566 +{{/code}} 567 + 568 +Upload folder as zip to a specified directory of a Project's Green Room by adding the ~-~-zip option. 569 + 570 +* The specified folder will then be compressed as a zip file and subsequently be uploaded to the specified destination. Once the upload is completed, the compressed zip file will be removed from the directory. Note: pilotcli must have the permission to create and delete zip files in the corresponding directory of your local machine: 571 + 572 +{{code language="none"}} 573 +$ pilotcli file upload ./sample_folder/example_folder -p cli/admin --zip 574 +Starting upload of: ./sample_folder/example_folder 575 +Started zipping files. 576 +Pre-upload complete. 577 +uploader: admin container_id: 18061 total_size: 3595 total_chunks: 1 uniq_identifier: 61a729ce-cdd6-4a87-82b5-3f8ea63e6c4a-1627499012 resumable_relative_path admin/ 578 + 579 +Upload job is finalizing, please wait... 580 +Upload job complete. 581 +All files uploaded successfully. 582 +{{/code}} 583 + 584 +Upload a file with tags and/or attributes. 585 + 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 {{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 +* 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 + 590 +{{code language="none"}} 591 +$ pilotcli file upload ./sample_folder/sample_file6 -p cli/admin -t tag1 -t tag2 -a cli_Manifest1_template.json 592 +File attribute validation passed: True 593 +Starting upload of: ./sample_folder/sample_file6 594 +Pre-upload complete. 595 +uploader: admin container_id: 18061 total_size: 1048576 total_chunks: 1 uniq_identifier: bc47ec2a-1a4e-4f71-a37a-7ce6473e415a-1627499273 resumable_relative_path admin/ 596 + 597 +Upload job is finalizing, please wait... 598 +Upload job complete. 599 +Attribute attached 600 +All files uploaded successfully. 601 +{{/code}} 602 + 603 +Upload a file with specified number of threads, using the {{code}}-td <thread_number>{{/code}} option. 604 + 605 +* 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: 606 + 607 +{{code language="none"}} 608 +$ pilotcli file upload -p indoctestproject/admin/test20230306_3 /home/color/indoc/script/large_folder_test_data/gentoo_root_100M.img -td 3 609 +Target folder does not exist. Would you like to create a new folder? [y/N]: y 610 +Starting upload of: /home/color/indoc/script/large_folder_test_data/gentoo_root_100M.img 611 +Pre-upload complete. 612 +Uploading gentoo_root_100M.img , resumable_id: c68752372b42c85d, job_id: 56de3632-58df-445c-bcb9-bddfe6be5bf7: |██████████████████████████████ 100% 00:00 613 +Upload Time: 79.77s for 1 files 614 +All uploading jobs have finished. 615 +{{/code}} 616 + 617 +(10) upload with customized manifest name 618 + 619 +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: 620 + 621 +{{code language="none"}} 622 +$ pilotcli file upload -p <path> <file> --output-path test_manifest.json 623 +{{/code}} 624 + 625 +== Command: **resume** == 626 + 627 +* **Options**: -td ~-~-thread, -r ~-~-resumable-manifest 628 +* **Usage**: Resume unfinished file uploading based on the manifest file. 629 +* ((( 630 +**Prerequisite**: 631 + 632 +* User login is required, otherwise an error is returned: "The current login session is invalid. Please login to continue." 633 +* Project must be accessible to the user, otherwise an error is returned: "Project Code not found in list. Please verify and try again." 634 +* The resumable manifest JSON file is required, which is generated upon executing the {{code}}pilotcli file upload{{/code}} command. 635 +))) 636 + 637 +=== Example: === 638 + 639 +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. 640 + 641 +{{code language="none"}} 642 +$ pilotcli file resume -r ./manifest.json 643 +Resume the upload for 10 files. 644 +Resumable upload check complete. 645 +Uploading aggregated.py: |██████████████████████████████ 100% 00:00 646 +Uploading __init__.py: |██████████████████████████████ 100% 00:00 647 +Uploading service_meta_class.py: |██████████████████████████████ 100% 00:00 648 +Uploading upload_form.py: |██████████████████████████████ 100% 00:00 649 +Uploading convert_type.py: |██████████████████████████████ 100% 00:00 650 +Uploading singleton.py: |██████████████████████████████ 100% 00:00 651 +Uploading __init__.py: |██████████████████████████████ 100% 00:00 652 +Uploading base_library.zip: |██████████████████████████████ 100% 00:00 0% ? 653 +Uploading EXE-00.toc: |██████████████████████████████ 100% 00:00 654 +Uploading xref-pilotcli_test20230227_3.html: |██████████████████████████████ 100% 00:00 655 +Upload Time: 11.13s for 10 files 656 +{{/code}} 657 + 658 +== Command: **sync** == 659 + 660 +* **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. 661 +* ((( 662 +**Options**: -z ~-~-zone, -i ~-~-geid, ~-~-zip 663 + 664 +* 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. 665 +))) 666 +* ((( 667 +**Prerequisite**: 668 + 669 +* User login is required, otherwise an error is returned: "The current login session is invalid. Please login to continue." 670 +* 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.” 671 +* 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.” 672 +))) 673 + 674 +{{code language="none"}} 675 +$ pilotcli file sync --help 676 +Usage: pilotcli file sync [OPTIONS] [PATHS]... OUTPUT_PATH 677 + 678 + Download files/folders from a given Project/folder/file in core zone. 679 + 680 +Options: 681 + -z, --zone TEXT Target Zone (i.e., core/greenroom) 682 + --zip Download files as a zip. 683 + -i, --geid Enable downloading by geid. 684 + --help Show this message and exit. 685 +{{/code}} 686 + 687 +=== Examples === 688 + 689 +Download a file or a folder from the Core zone of a Project: 690 + 691 +{{code language="none"}} 692 +$ pilotcli file sync cli/admin/sample_file2 -z core ~/Downloads/ 693 +Preparing status: READY_FOR_DOWNLOADING 694 +start downloading... 695 +Downloading sample_file2 |██████████████████████████████ 100% 00:00 696 +File has been downloaded successfully and saved to: /home/uname/Downloads/sample_file2 697 +{{/code}} 698 + 699 +Download multiple files or folders as a compressed zip by simply providing all source files or folders and adding the {{code}}--zip{{/code}} option: 700 + 701 +{{code language="none"}} 702 +$ pilotcli file sync cli/admin/sample_file2 cli/admin/sample_file7 -z core ~/Downloads/ --zip 703 +Preparing downloading 704 +Preparing status: READY_FOR_DOWNLOADING 705 +start downloading... 706 +Downloading cli_1632340658.768384.zip |██████████████████████████████ 100% 00:00 707 +File has been downloaded successfully and saved to: /home/uname/Downloads/cli_1632340658.768384.zip 708 +{{/code}} 709 + 710 +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: 711 + 712 +{{code language="none"}} 713 +$ pilotcli file sync -i 6d89afd4-f86e-4df7-b6c5-01a9af4e828e-1627499957 7e8e2bac-97c6-4738-bc08-12139c9ba225-1627498854 ~/Downloads/ 714 +Preparing status: READY_FOR_DOWNLOADING 715 +start downloading... 716 +Downloading sample_file7 |██████████████████████████████ 100% 00:00 717 +File has been downloaded successfully and saved to: /home/uname/Downloads/sample_file7 718 +Preparing status: READY_FOR_DOWNLOADING 719 +start downloading... 720 +Downloading sample_file2 |██████████████████████████████ 100% 00:00 721 +File has been downloaded successfully and saved to: /home/uname/Downloads/sample_file2 722 +{{/code}} 723 + 518 518 ---- 519 519 520 520 - ... ... @@ -524,5 +524,4 @@ 524 524 525 525 Copyright © 2023 [[Indoc Research>>url:https://www.indocresearch.org/]]. 526 526 527 -HealthDataCloud is powered by Pilot technology, a product of [[Indoc Research>>url:https://www.indocresearch.org/]].~{~{/code}} 528 -~)~)~) 733 +HealthDataCloud is powered by Pilot technology, a product of [[Indoc Research>>url:https://www.indocresearch.org/]].