Skip to content

Commit f8e87b7

Browse files
Kaiweitufacebook-github-bot
authored andcommitted
Let spark_standalone_remote_mini reuse dataset
Differential Revision: D115081461
1 parent 634bc47 commit f8e87b7

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

benchpress/config/jobs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,12 +808,16 @@
808808
- '--sanity {sanity}'
809809
- '--local-hostname "{local_hostname}"'
810810
- '--shuffle-partitions {shuffle_partitions}'
811+
- '--skip-datagen {skip_datagen}'
811812
vars:
812813
- 'ipv4=0'
813814
- 'sanity=0'
814815
- 'dataset_name=bpc_t93586_s2_synthetic_1GB'
815816
- 'local_hostname='
816817
- 'shuffle_partitions=20'
818+
# Reuse the warehouse instead of rebuilding it each run; the first run
819+
# still builds. Set to 0 to force a rebuild.
820+
- 'skip_datagen=1'
817821
hooks:
818822
- hook: copymove
819823
options:

packages/spark_standalone/templates/runner.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ def download_dataset(args):
5858
def install_database(args):
5959
metadata_dir = os.path.join(SPARK_DIR, "spark-4.0.3-bin-hadoop3", "metastore_db")
6060
database_dir = os.path.join(args.warehouse_dir, f"{args.dataset_name.lower()}.db")
61+
62+
# Require both: a half-present pair yields "Table or view not found".
63+
if getattr(args, "skip_datagen", 0):
64+
if os.path.exists(metadata_dir) and os.path.exists(database_dir):
65+
print(
66+
f"skip-datagen: reusing existing warehouse at {database_dir} "
67+
f"and metastore at {metadata_dir}"
68+
)
69+
return
70+
print(
71+
"skip-datagen requested but warehouse or metastore is missing; "
72+
"building the database this run"
73+
)
74+
6175
if os.path.exists(metadata_dir):
6276
print("Removing stale metastore_db to ensure tables are recreated")
6377
shutil.rmtree(metadata_dir)
@@ -457,6 +471,14 @@ def init_parser():
457471
default=0,
458472
help="sanity check for total read and write IOPS",
459473
)
474+
run_parser.add_argument(
475+
"--skip-datagen",
476+
type=int,
477+
default=0,
478+
choices=[0, 1],
479+
help="reuse an existing warehouse and metastore instead of rebuilding "
480+
"them. Falls back to building if either is missing.",
481+
)
460482
run_parser.add_argument("--real", action="store_true", help="for real")
461483
setup_parser.set_defaults(func=setup)
462484
run_parser.set_defaults(func=run)

0 commit comments

Comments
 (0)