-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #745 from openedx/bmtcril/operator_dash_enhancements
Operator Dashboard Enhancements
- Loading branch information
Showing
83 changed files
with
1,351 additions
and
4,718 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tutoraspects/patches/openedx-dev-dockerfile-post-python-requirements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \ | ||
pip install "platform-plugin-aspects==v0.7.2" | ||
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \ | ||
pip install "edx-event-routing-backends==v9.0.0" | ||
pip install "edx-event-routing-backends==v9.0.1" |
2 changes: 1 addition & 1 deletion
2
tutoraspects/patches/openedx-dockerfile-post-python-requirements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \ | ||
pip install "platform-plugin-aspects==v0.7.2" | ||
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \ | ||
pip install "edx-event-routing-backends==v9.0.0" | ||
pip install "edx-event-routing-backends==v9.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
tutoraspects/templates/aspects/apps/superset/pythonpath/create_assets_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
|
||
# This is taken from Superset's example utils: | ||
# https://github.com/apache/superset/blob/7081a0e73d872332a1a63727c9ff7a22159018bb/superset/examples/utils.py#L73 | ||
|
||
# Changes were added to mock out the security manager, since the other options | ||
# are to either replicate asset import entirely or to use the "examples" | ||
# version, which skips a variety of other checks. | ||
import logging | ||
import yaml | ||
from pathlib import Path | ||
|
||
from flask import g | ||
from superset.commands.exceptions import CommandInvalidError | ||
from superset.commands.importers.v1.assets import ImportAssetsCommand | ||
from superset.commands.importers.v1.utils import METADATA_FILE_NAME | ||
from superset.commands.database.importers.v1.utils import security_manager | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
# This logger is really spammy | ||
model_helper_logger = logging.getLogger("superset.models.helpers") | ||
model_helper_logger.setLevel(logging.WARNING) | ||
|
||
|
||
YAML_EXTENSIONS = {".yaml", ".yml"} | ||
|
||
|
||
|
||
def load_configs_from_directory( | ||
root: Path, overwrite: bool = True, force_data: bool = False | ||
) -> None: | ||
""" | ||
Load all the examples from a given directory. | ||
""" | ||
contents: dict[str, str] = {} | ||
queue = [root] | ||
while queue: | ||
path_name = queue.pop() | ||
if path_name.is_dir(): | ||
queue.extend(path_name.glob("*")) | ||
elif path_name.suffix.lower() in YAML_EXTENSIONS: | ||
with open(path_name) as fp: | ||
contents[str(path_name.relative_to(root))] = fp.read() | ||
|
||
# removing "type" from the metadata allows us to import any exported model | ||
# from the unzipped directory directly | ||
metadata = yaml.load(contents.get(METADATA_FILE_NAME, "{}"), Loader=yaml.Loader) | ||
if "type" in metadata: | ||
del metadata["type"] | ||
contents[METADATA_FILE_NAME] = yaml.dump(metadata) | ||
|
||
# Force our use to the admin user to prevent errors on import | ||
g.user = security_manager.find_user(username="{{SUPERSET_ADMIN_USERNAME}}") | ||
|
||
command = ImportAssetsCommand( | ||
contents, | ||
overwrite=overwrite, | ||
force_data=force_data, | ||
) | ||
try: | ||
command.run() | ||
except CommandInvalidError as ex: | ||
logger.error("An error occurred: %s", ex.normalized_messages()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
tutoraspects/templates/aspects/apps/superset/scripts/import-assets.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
mkdir -p /app/assets/ | ||
cd /app/assets/ | ||
rm -rf superset | ||
|
Oops, something went wrong.