Skip to content

Commit

Permalink
clarifying messages, removing some useless output
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Dec 16, 2024
1 parent cd6cc34 commit 29fd4a3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
9 changes: 4 additions & 5 deletions docker/docker-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ set -eo pipefail

# Make python interactive
if [ "$DEV_MODE" == "true" ]; then
echo "Reinstalling the app in editable mode"
echo "[DEV_MODE detected] Setting the superset package to be in editable mode"
echo "RUN: uv pip install -e ."
uv pip install -e .
fi
REQUIREMENTS_LOCAL="/app/docker/requirements-local.txt"
Expand All @@ -34,10 +35,8 @@ fi
# Make sure we have dev requirements installed
#
if [ -f "${REQUIREMENTS_LOCAL}" ]; then
echo "Installing local overrides at ${REQUIREMENTS_LOCAL}"
pip install --no-cache-dir -r "${REQUIREMENTS_LOCAL}"
else
echo "Skipping local overrides"
echo "Installing python packages specified at ${REQUIREMENTS_LOCAL}"
uv pip install --no-cache-dir -r "${REQUIREMENTS_LOCAL}"
fi

case "${1}" in
Expand Down
12 changes: 1 addition & 11 deletions docker/docker-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,9 @@ fi

echo_step() {
cat <<EOF
######################################################################
Init Step ${1}/${STEP_CNT} [${2}] -- ${3}
Docker Init Step ${1}/${STEP_CNT} [${2}] -- ${3}
######################################################################
EOF
}
ADMIN_PASSWORD="${ADMIN_PASSWORD:-admin}"
Expand All @@ -52,7 +46,6 @@ fi
# Initialize the database
echo_step "1" "Starting" "Applying DB migrations"
superset db upgrade
echo_step "1" "Complete" "Applying DB migrations"

# Create an admin user
echo_step "2" "Starting" "Setting up admin user ( admin / $ADMIN_PASSWORD )"
Expand All @@ -62,11 +55,9 @@ superset fab create-admin \
--lastname Admin \
--email [email protected] \
--password "$ADMIN_PASSWORD"
echo_step "2" "Complete" "Setting up admin user"
# Create default roles and permissions
echo_step "3" "Starting" "Setting up roles and perms"
superset init
echo_step "3" "Complete" "Setting up roles and perms"

if [ "$SUPERSET_LOAD_EXAMPLES" = "yes" ]; then
# Load some data to play with
Expand All @@ -78,5 +69,4 @@ if [ "$SUPERSET_LOAD_EXAMPLES" = "yes" ]; then
else
superset load_examples --force
fi
echo_step "4" "Complete" "Loading examples"
fi
4 changes: 2 additions & 2 deletions superset/commands/dataset/importers/v1/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def load_data(data_uri: str, dataset: SqlaTable, database: Database) -> None:

# reuse session when loading data if possible, to make import atomic
if database.sqlalchemy_uri == current_app.config.get("SQLALCHEMY_DATABASE_URI"):
logger.info("Loading data inside the import transaction")
logger.debug("Loading data inside the import transaction")
connection = db.session.connection()
df.to_sql(
dataset.table_name,
Expand All @@ -219,7 +219,7 @@ def load_data(data_uri: str, dataset: SqlaTable, database: Database) -> None:
method="multi",
)
else:
logger.warning("Loading data outside the import transaction")
logger.debug("Loading data outside the import transaction")
with database.get_sqla_engine(
catalog=dataset.catalog,
schema=dataset.schema,
Expand Down
12 changes: 7 additions & 5 deletions superset/examples/birth_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import logging
import textwrap
from typing import Union

Expand All @@ -40,6 +41,8 @@
update_slice_ids,
)

logger = logging.getLogger(__name__)


def gen_filter(
subject: str, comparator: str, operator: str = "=="
Expand Down Expand Up @@ -83,8 +86,7 @@ def load_data(tbl_name: str, database: Database, sample: bool = False) -> None:
method="multi",
index=False,
)
print("Done loading table!")
print("-" * 80)
logging.debug("Done loading table!")


def load_birth_names(
Expand All @@ -104,7 +106,7 @@ def load_birth_names(
table = get_table_connector_registry()
obj = db.session.query(table).filter_by(table_name=tbl_name, schema=schema).first()
if not obj:
print(f"Creating table [{tbl_name}] reference")
logging.debug(f"Creating table [{tbl_name}] reference")
obj = table(table_name=tbl_name, schema=schema)
db.session.add(obj)

Expand Down Expand Up @@ -196,7 +198,7 @@ def create_slices(tbl: SqlaTable) -> tuple[list[Slice], list[Slice]]:
"datasource_type": DatasourceType.TABLE,
}

print("Creating some slices")
logger.debug("Creating some slices")
slices = [
Slice(
**slice_kwargs,
Expand Down Expand Up @@ -561,7 +563,7 @@ def create_slices(tbl: SqlaTable) -> tuple[list[Slice], list[Slice]]:


def create_dashboard(slices: list[Slice]) -> Dashboard:
print("Creating a dashboard")
logger.debug("Creating a dashboard")
dash = db.session.query(Dashboard).filter_by(slug="births").first()
if not dash:
dash = Dashboard()
Expand Down

0 comments on commit 29fd4a3

Please sign in to comment.