Skip to content

Commit 60b97b3

Browse files
authored
Exclude hidden files when uploading, and remove option to use third party client from CLI (#63)
* ignore hidden files * remove third party tool option * lint and bump version
1 parent e206cfa commit 60b97b3

File tree

8 files changed

+12
-47
lines changed

8 files changed

+12
-47
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Options:
3636
--project TEXT Name or ID of the project
3737
--dataset TEXT ID of the dataset
3838
--data-directory TEXT Directory to store the files
39-
--interactive Gather arguments interactively
39+
-i, --interactive Gather arguments interactively
4040
--help Show this message and exit.
4141
```
4242

@@ -52,8 +52,7 @@ Options:
5252
--project TEXT Name or ID of the project
5353
--process TEXT Name or ID of the ingest process
5454
--data-directory TEXT Directory you wish to upload
55-
--interactive Gather arguments interactively
56-
--use-third-party-tool Use third party tool for upload (Generate manifest and one-time upload authentication token)
55+
-i, --interactive Gather arguments interactively
5756
--help Show this message and exit.
5857
```
5958

@@ -65,7 +64,7 @@ Usage: cirro-cli list-datasets [OPTIONS]
6564

6665
Options:
6766
--project TEXT ID of the project
68-
--interactive Gather arguments interactively
67+
-i, --interactive Gather arguments interactively
6968
--help Show this message and exit.
7069
```
7170

@@ -83,7 +82,6 @@ $ cirro-cli upload --interactive
8382
? What type of files? Illumina Sequencing Run
8483
? What is the name of this dataset? test
8584
? Enter a description of the dataset (optional)
86-
? How would you like to upload or download your data? Cirro CLI
8785
```
8886

8987
## Python Usage

cirro/cli/cli.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ def download(**kwargs):
5959
@click.option('-i', '--interactive',
6060
help='Gather arguments interactively',
6161
is_flag=True, default=False)
62-
@click.option('--use-third-party-tool',
63-
help='Use third party tool for upload (Generate manifest and one-time upload authentication token)',
64-
is_flag=True, default=False)
6562
def upload(**kwargs):
6663
check_required_args(kwargs)
6764
run_ingest(kwargs, interactive=kwargs.get('interactive'))

cirro/cli/controller.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from cirro.api.clients.portal import DataPortalClient
22
from cirro.api.config import UserConfig, save_user_config
33
from cirro.api.models.dataset import CreateIngestDatasetInput
4-
from cirro.api.models.file import FileAccessContext
54
from cirro.api.models.process import Executor
65
from cirro.cli.interactive.auth_args import gather_auth_config
76
from cirro.cli.interactive.download_args import gather_download_arguments, ask_dataset_files
@@ -16,7 +15,6 @@
1615
from cirro.cli.models import ListArguments, UploadArguments, DownloadArguments
1716
from cirro.file_utils import get_files_in_directory
1817
from cirro.helpers import WorkflowConfigBuilder
19-
from cirro.utils import print_credentials
2018

2119

2220
def run_list_datasets(input_params: ListArguments, interactive=False):
@@ -78,24 +76,10 @@ def run_ingest(input_params: UploadArguments, interactive=False):
7876

7977
create_resp = cirro.dataset.create(create_request)
8078

81-
if input_params['use_third_party_tool']:
82-
token_lifetime = 1 # TODO: Max token lifetime is 1 hour?
83-
access_context = FileAccessContext.upload_dataset(project_id=create_request.project_id,
84-
dataset_id=create_resp['datasetId'],
85-
token_lifetime_override=token_lifetime)
86-
creds = cirro.file.get_access_credentials(access_context)
87-
print()
88-
print("Please use the following information in your tool:")
89-
print(f"Bucket: {access_context.bucket}")
90-
print(f"Data path: {create_resp['dataPath']}")
91-
print()
92-
print_credentials(creds)
93-
94-
else:
95-
cirro.dataset.upload_files(dataset_id=create_resp['datasetId'],
96-
project_id=create_request.project_id,
97-
directory=directory,
98-
files=files)
79+
cirro.dataset.upload_files(dataset_id=create_resp['datasetId'],
80+
project_id=create_request.project_id,
81+
directory=directory,
82+
files=files)
9983

10084

10185
def run_download(input_params: DownloadArguments, interactive=False):

cirro/cli/interactive/common_args.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,3 @@ def ask_project(projects: List[Project], input_value: str) -> str:
1515
}
1616
answers = prompt_wrapper(project_prompt)
1717
return answers['project']
18-
19-
20-
def ask_use_third_party_tool():
21-
answers = prompt_wrapper({
22-
'type': 'list',
23-
'message': 'How would you like to upload or download your data?',
24-
'name': 'use_tool',
25-
'choices': [
26-
"Cirro CLI",
27-
"Third-party tool (using AWS credentials temporarily issued for download)"
28-
]
29-
})
30-
31-
return answers['use_tool'] != 'Cirro CLI'

cirro/cli/interactive/upload_args.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from cirro.api.models.process import Process
99
from cirro.api.models.project import Project
10-
from cirro.cli.interactive.common_args import ask_project, ask_use_third_party_tool
10+
from cirro.cli.interactive.common_args import ask_project
1111
from cirro.cli.interactive.utils import prompt_wrapper
1212
from cirro.cli.models import UploadArguments
1313
from cirro.file_utils import get_directory_stats
@@ -101,6 +101,4 @@ def gather_upload_arguments(input_params: UploadArguments, projects: List[Projec
101101
default_name = input_params.get('name') or data_directory_name
102102
input_params['name'] = ask_name(default_name)
103103
input_params['description'] = ask_description(input_params.get('description'))
104-
105-
input_params['use_third_party_tool'] = ask_use_third_party_tool()
106104
return input_params

cirro/cli/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class UploadArguments(TypedDict):
1515
process: str
1616
data_directory: str
1717
interactive: bool
18-
use_third_party_tool: bool
1918

2019

2120
class ListArguments(TypedDict):

cirro/file_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ def get_files_in_directory(directory) -> List[str]:
3131
for file_path in path.rglob("*"):
3232
if file_path.is_dir():
3333
continue
34+
if file_path.name.startswith('.'):
35+
continue
36+
3437
str_file_path = str(file_path.as_posix())
3538
str_file_path = str_file_path.replace(f'{path_posix}/', "")
3639
paths.append(str_file_path)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "cirro"
3-
version = "0.6.6"
3+
version = "0.6.7"
44
description = "CLI tool and SDK for interacting with the Cirro platform"
55
authors = ["Fred Hutch <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)