[
https://issues.apache.org/jira/browse/BEAM-13633?focusedWorklogId=724455&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-724455
]
ASF GitHub Bot logged work on BEAM-13633:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 10/Feb/22 12:17
Start Date: 10/Feb/22 12:17
Worklog Time Spent: 10m
Work Description: pavel-avilov commented on a change in pull request
#16484:
URL: https://github.com/apache/beam/pull/16484#discussion_r803613949
##########
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__()
Review comment:
Done
##########
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:
+ """
+ Write paths to default examples to the file (in temp folder)
+
+ Args:
+ paths: dict with paths
+
+ Returns: name of the file
+
+ """
+ cloud_path = os.path.join([*paths].pop(),
+ Config.DEFAULT_PRECOMPILED_OBJECTS)
+
+ path_to_file = os.path.join(Config.TEMP_FOLDER, [*paths].pop())
+ Path(path_to_file).mkdir(parents=True, exist_ok=True)
+
+ local_path = os.path.join(path_to_file, Config.DEFAULT_PRECOMPILED_OBJECTS)
+ content = json.dumps(paths)
+ with open(local_path, "x", encoding="utf-8") as file:
Review comment:
Done
##########
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:
Done
--
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: 724455)
Time Spent: 6h 20m (was: 6h 10m)
> 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 20m
> 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)