milenkovicm commented on code in PR #1742: URL: https://github.com/apache/datafusion-ballista/pull/1742#discussion_r3339961073
########## ballista-cli/src/wasm.rs: ########## @@ -0,0 +1,56 @@ +// 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. + +#![cfg(feature = "web")] + +use tracing_subscriber::fmt::format::Pretty; +use tracing_subscriber::prelude::*; +use tracing_web::{MakeWebConsoleWriter, performance_layer}; +use wasm_bindgen::prelude::*; +use wasm_bindgen_futures::spawn_local; + +/// WASM entry point. Registered as the `start` function so the browser calls it +/// automatically when the WASM module is loaded. Review Comment: would it make sense to capture how to run it? its mentioned in the PR description, IMHO we could mentioned here ``` cargo binstall trunk cd ballista-cli trunk serve --no-default-features --features web open http://localhost:8080 ``` or `main.rs` wherever is more appropriate ########## ballista/scheduler/src/api/routes.rs: ########## @@ -61,5 +62,32 @@ pub fn get_routes< get(handlers::get_job_svg_graph::<T, U>), ); - router.with_state(scheduler_server) + router.with_state(scheduler_server).layer(cors()) +} + +fn cors() -> CorsLayer { + let allowed_origins = std::env::var("BALLISTA_CORS_ALLOWED_ORIGINS") Review Comment: i dont think we use env vars for ballista config (this deep in the codebase) perhaps we could extract it to a new scheduler config and pass it around. we can keep it temporary, and remove it later ########## ballista-cli/Trunk.toml: ########## @@ -0,0 +1,32 @@ +# 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. + Review Comment: one sentence describing what this file is used for (and maybe how to use it) may be good for us not used to wasm build process ########## ci/scripts/rust_clippy.sh: ########## @@ -18,4 +18,11 @@ # under the License. set -ex -cargo clippy --all-targets --workspace --all-features -- -D warnings Review Comment: why did we need to change this ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
