Skip to content

Commit 9c4f3f7

Browse files
author
james
committed
update
1 parent 23a7cb1 commit 9c4f3f7

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

FeathrSandbox.Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,31 @@ RUN echo 'REACT_APP_API_ENDPOINT=http://localhost:8000' >> .env.production
1010
RUN npm install && npm run build
1111

1212

13+
14+
# Stage 1: build frontend ui
15+
FROM gradle:7.6.0-jdk8 as gradle-build
16+
WORKDIR /usr/src/feathr
17+
18+
# for folers, we need to specify the dest foler name
19+
# COPY feathr-compute/ ./feathr-compute/
20+
# COPY feathr-config/ ./feathr-config/
21+
# COPY feathr-data-models/ ./feathr-data-models/
22+
# COPY feathr-impl/ ./feathr-impl/
23+
# COPY gradle/ ./gradle/
24+
# COPY gradle.properties .
25+
# COPY gradlew .
26+
# COPY gradlew.bat .
27+
# COPY repositories.gradle .
28+
# COPY settings.gradle .
29+
# COPY ["feathr-compute/", "feathr-config/", "feathr-data-models/", "feathr-impl/", "gradle/","gradle.properties", "gradlew", "gradlew.bat", "build.gradle", "repositories.gradle", "settings.gradle", "./"]
30+
COPY . .
31+
RUN ./gradlew build
32+
33+
1334
FROM jupyter/pyspark-notebook
1435

36+
37+
1538
USER root
1639

1740
## Install dependencies
@@ -53,6 +76,7 @@ USER jovyan
5376
# UID is like this: uid=1000(jovyan) gid=100(users) groups=100(users)
5477
COPY --chown=1000:100 ./docs/samples/local_quickstart_notebook.ipynb .
5578
COPY --chown=1000:100 ./feathr-sandbox/feathr_init_script.py .
79+
COPY --chown=1000:100 --from=gradle-build /usr/src/feathr/build/libs .
5680

5781
# Run the script so that maven cache can be added for better experience. Otherwise users might have to wait for some time for the maven cache to be ready.
5882
RUN python feathr_init_script.py

feathr-sandbox/feathr_init_script.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
os.environ['SPARK_LOCAL_IP'] = "127.0.0.1"
2020
os.environ['REDIS_PASSWORD'] = "foobared" # default password for Redis
21-
2221
yaml_config = f"""
2322
api_version: 1
2423
project_config:
@@ -30,7 +29,7 @@
3029
spark_result_output_parts: '1'
3130
local:
3231
master: 'local[*]'
33-
feathr_runtime_location:
32+
feathr_runtime_location: "./feathr_2.12-{feathr.__version__}.jar"
3433
3534
online_store:
3635
redis:
@@ -44,6 +43,8 @@
4443
api_endpoint: "http://127.0.0.1:8000/api/v1"
4544
"""
4645

46+
print(yaml_config)
47+
4748
tmp = tempfile.NamedTemporaryFile(mode='w', delete=False)
4849
with open(tmp.name, "w") as text_file:
4950
text_file.write(yaml_config)

feathr_project/feathr/spark_provider/_localspark_submission.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,23 @@ def submit_feathr_job(
106106
print(python_files)
107107
spark_args.append(python_files[0])
108108
else:
109-
spark_args.extend(["--class", main_class_name, main_jar_path])
109+
if not python_files:
110+
# This is a JAR job
111+
# Azure Synapse/Livy doesn't allow JAR job starts from Maven directly, we must have a jar file uploaded.
112+
# so we have to use a dummy jar as the main file.
113+
# Use the no-op jar as the main file
114+
# This is a dummy jar which contains only one `org.example.Noop` class with one empty `main` function
115+
# which does nothing
116+
main_jar_path = main_jar_path
117+
spark_args.extend(["--packages", maven_dependency, "--class", main_class_name, main_jar_path])
118+
else:
119+
spark_args.extend(["--packages", maven_dependency])
120+
# This is a PySpark job, no more things to
121+
if python_files.__len__() > 1:
122+
spark_args.extend(["--py-files", ",".join(python_files[1:])])
123+
print(python_files)
124+
spark_args.append(python_files[0])
125+
110126

111127
if arguments:
112128
spark_args.extend(arguments)

0 commit comments

Comments
 (0)