[
https://issues.apache.org/jira/browse/BEAM-13633?focusedWorklogId=723688&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-723688
]
ASF GitHub Bot logged work on BEAM-13633:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 09/Feb/22 14:26
Start Date: 09/Feb/22 14:26
Worklog Time Spent: 10m
Work Description: KhaninArtur commented on a change in pull request
#16484:
URL: https://github.com/apache/beam/pull/16484#discussion_r802716458
##########
File path: playground/infrastructure/cd_helper.py
##########
@@ -103,12 +103,49 @@ def _save_to_cloud_storage(self, examples: List[Example]):
"""
self._storage_client = storage.Client()
self._bucket = self._storage_client.bucket(Config.BUCKET_NAME)
+
+ default_examples_paths = {}
for example in tqdm(examples):
file_names = self._write_to_local_fs(example)
+
+ if example.tag.default_example:
+ default_examples_paths[Sdk.Name(example.sdk)] = Path(
+ [*file_names].pop()).parent.__str__()
+
for cloud_file_name, local_file_name in file_names.items():
self._upload_blob(
source_file=local_file_name, destination_blob_name=cloud_file_name)
+ if len(default_examples_paths) > 0:
+ cloud_path = self._write_default_examples_paths_to_local_fs(
+ default_examples_paths)
+ self._upload_blob(
+ source_file=os.path.join(Config.TEMP_FOLDER, cloud_path),
+ destination_blob_name=cloud_path)
+
+ def _write_default_examples_paths_to_local_fs(self, paths: {}) -> str:
Review comment:
Do we have unit tests for this code?
##########
File path: playground/infrastructure/cd_helper.py
##########
@@ -103,12 +103,49 @@ def _save_to_cloud_storage(self, examples: List[Example]):
"""
self._storage_client = storage.Client()
self._bucket = self._storage_client.bucket(Config.BUCKET_NAME)
+
+ default_examples_paths = {}
for example in tqdm(examples):
file_names = self._write_to_local_fs(example)
+
+ if example.tag.default_example:
+ default_examples_paths[Sdk.Name(example.sdk)] = Path(
+ [*file_names].pop()).parent.__str__()
+
for cloud_file_name, local_file_name in file_names.items():
self._upload_blob(
source_file=local_file_name, destination_blob_name=cloud_file_name)
+ if len(default_examples_paths) > 0:
+ cloud_path = self._write_default_examples_paths_to_local_fs(
+ default_examples_paths)
+ self._upload_blob(
+ source_file=os.path.join(Config.TEMP_FOLDER, cloud_path),
+ destination_blob_name=cloud_path)
+
+ def _write_default_examples_paths_to_local_fs(self, paths: {}) -> str:
Review comment:
Do you want to annotate the argument `paths` as a set? If so, it is
better to do so explicitly like `paths: set`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 723688)
Time Spent: 6h (was: 5h 50m)
> Implement method to get a default example for each SDKs
> -------------------------------------------------------
>
> Key: BEAM-13633
> URL: https://issues.apache.org/jira/browse/BEAM-13633
> Project: Beam
> Issue Type: Sub-task
> Components: beam-playground
> Reporter: Pavel Avilov
> Assignee: Pavel Avilov
> Priority: P2
> Labels: beam-playground-backend, beam-playground-sprint-7
> Time Spent: 6h
> Remaining Estimate: 0h
>
> Need to implement a method that will return a default example for each SDKs.
> Store the description of default examples in the config.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)