Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tutoraspects/asset_command_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ class ChartAsset(Asset):
"params.dashboards",
"params.datasource",
"params.slice_id",
"tags",
'params.annotation_layers'
]
raw_vars = ["sqlExpression", "query_context", "translate_column"]

Expand All @@ -203,6 +205,7 @@ class DashboardAsset(Asset):

path = "dashboards"
required_vars = ["_roles"]
omitted_vars = ["tags"]


class DatasetAsset(Asset):
Expand All @@ -212,7 +215,7 @@ class DatasetAsset(Asset):

path = "datasets"
templated_vars = ["schema", "table_name", "sql"]
omitted_vars = ["extra.certification"]
omitted_vars = ["extra.certification", "catalog", "folders"]

def process(self, content: dict, existing: dict):
"""
Expand Down Expand Up @@ -260,7 +263,6 @@ def validate_asset_file(
Append last 6 characters of uuid for charts
"""
orig_filename = os.path.basename(asset_path)

# make sure to not change the dashboard filename if we happen
# to have a chart with the same name
if not content.get("dashboard_title"):
Expand Down Expand Up @@ -345,7 +347,7 @@ def import_superset_assets(

with ZipFile(file.name) as zip_file:
for asset_path in zip_file.namelist():
if "metadata.yaml" in asset_path:
if "metadata.yaml" in asset_path or "tags.yaml" in asset_path:
continue
with zip_file.open(asset_path) as asset_file:
content = yaml.safe_load(asset_file)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% if ASPECTS_ENABLE_STUDIO_IN_CONTEXT_METRICS %}
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install openedx/frontend-plugin-aspects
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install git+https://github.com/openedx/frontend-plugin-aspects#v1.0.0
{% endif %}
18 changes: 18 additions & 0 deletions tutoraspects/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,25 @@
(
"SUPERSET_DASHBOARD_LOCALES",
[
# "ar",
# "da",
# "de_DE",
# "el",
"en",
# "es_419",
# "es_ES",
# "fr_CA",
# "he",
# "hi",
# "id",
# "it_IT",
# "pt_BR",
# "pt_PT",
# "ru",
# "th",
# "tr_TR",
# "uk",
# "zh_CN",
],
),
("SUPERSET_EXTRA_JINJA_FILTERS", {}),
Expand Down
7 changes: 0 additions & 7 deletions tutoraspects/templates/aspects/apps/superset/conf/README.md

This file was deleted.

Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from superset.extensions import security_manager
from superset.migrations.shared.security_converge import Role

session = security_manager.get_session()
session = security_manager.session

## https://docs.preset.io/docs/row-level-security-rls

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
# https://github.com/apache/superset/blob/master/Dockerfile
# https://superset.apache.org/docs/databases/installing-database-drivers

FROM apache/superset:4.1.1
FROM apache/superset:6.0.0rc2

USER root

COPY ./requirements.txt /app/requirements.txt
COPY ./localization/compile_translations.py /app/localization/compile_translations.py
COPY ./localization/datasets_strings.yaml /app/localization/datasets_strings.yaml
COPY ./openedx-assets /app/openedx-assets

# Extracted from https://superset.apache.org/docs/installation/alerts-reports/#custom-dockerfile
# https://github.com/apache/superset/blob/3.0.0/Dockerfile#L118-L132
Expand All @@ -27,9 +28,9 @@ RUN apt-get update -qq \
&& ln -s /opt/firefox/firefox /usr/local/bin/firefox \
&& apt-get autoremove -yqq --purge wget bzip2 && rm -rf /var/[log,tmp]/* /tmp/* /var/lib/apt/lists/*

RUN pip install -r /app/requirements.txt
RUN --mount=type=cache,target=${SUPERSET_HOME}/.cache/uv \
uv pip install -r /app/requirements.txt

COPY ./openedx-assets /app/openedx-assets

# Pull latest aspects translations from openedx-tranlsations repository
RUN atlas pull translations/tutor-contrib-aspects/tutoraspects/templates/aspects/apps/superset/conf/locale:/app/localization/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env bash
#
# 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.
#

set -eo pipefail

# Make python interactive
if [ "$DEV_MODE" == "true" ]; then
if [ "$(whoami)" = "root" ] && command -v uv > /dev/null 2>&1; then
echo "Reinstalling the app in editable mode"
uv pip install -e .
fi
fi
REQUIREMENTS_LOCAL="/app/docker/requirements-local.txt"
PORT=${PORT:-8088}
# If Cypress run – overwrite the password for admin and export env variables
if [ "$CYPRESS_CONFIG" == "true" ]; then
export SUPERSET_TESTENV=true
export POSTGRES_DB=superset_cypress
export SUPERSET__SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://superset:superset@db:5432/superset_cypress
PORT=8081
fi
if [[ "$DATABASE_DIALECT" == postgres* ]] && [ "$(whoami)" = "root" ]; then
# older images may not have the postgres dev requirements installed
echo "Installing postgres requirements"
if command -v uv > /dev/null 2>&1; then
# Use uv in newer images
uv pip install -e .[postgres]
else
# Use pip in older images
pip install -e .[postgres]
fi
fi
#
# Make sure we have dev requirements installed
#
if [ -f "${REQUIREMENTS_LOCAL}" ]; then
echo "Installing local overrides at ${REQUIREMENTS_LOCAL}"
if command -v uv > /dev/null 2>&1; then
uv pip install --no-cache-dir -r "${REQUIREMENTS_LOCAL}"
else
pip install --no-cache-dir -r "${REQUIREMENTS_LOCAL}"
fi
else
echo "Skipping local overrides"
fi

case "${1}" in
worker)
echo "Starting Celery worker..."
# setting up only 2 workers by default to contain memory usage in dev environments
celery --app=superset.tasks.celery_app:app worker -O fair -l INFO --concurrency=${CELERYD_CONCURRENCY:-2}
;;
beat)
echo "Starting Celery beat..."
rm -f /tmp/celerybeat.pid
celery --app=superset.tasks.celery_app:app beat --pidfile /tmp/celerybeat.pid -l INFO -s "${SUPERSET_HOME}"/celerybeat-schedule
;;
app)
echo "Starting web app (using development server)..."
flask run -p $PORT --with-threads --reload --debugger --host=0.0.0.0
;;
app-gunicorn)
echo "Starting web app..."
/usr/bin/run-server.sh
;;
*)
echo "Unknown Operation!!!"
;;
esac
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,21 @@ params:
sqlExpression: uniqCombinedMerge(courses_cnt)
only_total: true
opacity: 0.2
order_desc: true
rich_tooltip: true
row_limit: 10000
seriesType: line
showTooltipTotal: true
show_empty_columns: true
show_legend: false
sort_series_type: sum
time_grain_sqla: P1D
time_shift_color: true
tooltipTimeFormat: smart_date
truncateXAxis: false
truncate_metric: false
viz_type: echarts_timeseries_line
xAxisLabelInterval: auto
x_axis: emission_hour
x_axis_sort_asc: true
x_axis_sort_series: name
x_axis_sort_series_ascending: true
x_axis_time_format: '%Y-%m-%d'
x_axis_title_margin: 15
y_axis_bounds:
Expand Down Expand Up @@ -98,25 +97,24 @@ query_context:
sqlExpression: uniqCombinedMerge(courses_cnt)
only_total: true
opacity: 0.2
order_desc: true
result_format: json
result_type: full
rich_tooltip: true
row_limit: 10000
seriesType: line
showTooltipTotal: true
show_empty_columns: true
show_legend: false
slice_id: 3402
sort_series_type: sum
time_grain_sqla: P1D
time_shift_color: true
tooltipTimeFormat: smart_date
truncateXAxis: false
truncate_metric: false
viz_type: echarts_timeseries_line
xAxisLabelInterval: auto
x_axis: emission_hour
x_axis_sort_asc: true
x_axis_sort_series: name
x_axis_sort_series_ascending: true
x_axis_time_format: '%Y-%m-%d'
x_axis_title_margin: 15
y_axis_bounds:
Expand Down Expand Up @@ -145,6 +143,7 @@ query_context:
- col: emission_hour
op: TEMPORAL_RANGE
val: No filter
group_others_when_limit_reached: false
metrics:
- aggregate: null
column: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,22 @@ params:
minorTicks: false
only_total: true
opacity: 0.2
order_desc: true
rich_tooltip: true
row_limit: 10000
seriesType: line
showTooltipTotal: true
show_empty_columns: true
show_legend: false
sort_series_type: sum
time_grain_sqla: P1D
time_shift_color: true
tooltipTimeFormat: smart_date
truncateXAxis: false
truncateYAxis: false
truncate_metric: true
viz_type: echarts_timeseries_line
xAxisLabelInterval: auto
x_axis: emission_day
x_axis_sort_asc: true
x_axis_sort_series: name
x_axis_sort_series_ascending: true
x_axis_time_format: '%Y-%m-%d'
x_axis_title_margin: 15
y_axis_bounds:
Expand Down Expand Up @@ -115,26 +114,25 @@ query_context:
minorTicks: false
only_total: true
opacity: 0.2
order_desc: true
result_format: json
result_type: full
rich_tooltip: true
row_limit: 10000
seriesType: line
showTooltipTotal: true
show_empty_columns: true
show_legend: false
slice_id: 3403
sort_series_type: sum
time_grain_sqla: P1D
time_shift_color: true
tooltipTimeFormat: smart_date
truncateXAxis: false
truncateYAxis: false
truncate_metric: true
viz_type: echarts_timeseries_line
xAxisLabelInterval: auto
x_axis: emission_day
x_axis_sort_asc: true
x_axis_sort_series: name
x_axis_sort_series_ascending: true
x_axis_time_format: '%Y-%m-%d'
x_axis_title_margin: 15
y_axis_bounds:
Expand Down Expand Up @@ -166,6 +164,7 @@ query_context:
- col: emission_day
op: TEMPORAL_RANGE
val: No filter
group_others_when_limit_reached: false
metrics:
- aggregate: null
column: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ params:
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_time
annotation_layers: []
color_scheme: supersetColors
date_format: smart_date
extra_form_data: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ params:
- name
- value
- description
annotation_layers: []
allow_render_html: true
color_pn: true
comparison_color_scheme: Green
comparison_type: values
extra_form_data: {}
groupby: []
order_by_cols: []
order_desc: true
percent_metric_calculation: row_limit
percent_metrics: []
query_mode: raw
row_limit: 1000
server_page_length: 10
show_cell_bars: true
table_timestamp_format: smart_date
temporal_columns_lookup: {}
time_grain_sqla: P1D
viz_type: table
query_context: null
slice_name: ClickHouse metrics
Expand Down
Loading
Loading