Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed Apr 26, 2024
1 parent c73e7db commit 8b0f822
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions backend/windmill-worker/src/go_executor.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::{collections::HashMap, process::Stdio};

use bytes::{Buf, Bytes};
use bytes::Bytes;
use itertools::Itertools;
use object_store::path::Path;
use serde_json::value::RawValue;
use tokio::{
fs::{create_dir, DirBuilder, File},
Expand All @@ -23,9 +22,8 @@ use windmill_queue::{append_logs, CanceledBy};
use crate::{
common::{
capitalize, create_args_and_out_file, get_reserved_variables, handle_child, read_result,
start_child_process, write_file, write_file_binary,
start_child_process, write_file,
},
global_cache::{attempt_fetch_bytes, pull_from_tar},
AuthedClientBackgroundTask, DISABLE_NSJAIL, DISABLE_NUSER, GOPRIVATE, GOPROXY,
GO_BIN_CACHE_DIR, GO_CACHE_DIR, HOME_ENV, NSJAIL_PATH, PATH_ENV, TZ_ENV,
};
Expand All @@ -47,7 +45,13 @@ pub async fn save_cache(
let job_main_path = format!("{job_dir}/main");
let mut cached_to_s3 = false;
#[cfg(all(feature = "enterprise", feature = "parquet"))]
if let Some(os) = OBJECT_STORE_CACHE_SETTINGS.read().await.clone() {
if let Some(os) = windmill_common::s3_helpers::OBJECT_STORE_CACHE_SETTINGS
.read()
.await
.clone()
{
use object_store::path::Path;

let hash_path = hash_to_os_path(hash);
if let Err(e) = os
.put(
Expand Down Expand Up @@ -110,7 +114,13 @@ async fn load_cache(bin_path: &str, hash: &str) -> (bool, String) {
(true, format!("loaded bin from local cache: {}\n", bin_path))
} else {
#[cfg(all(feature = "enterprise", feature = "parquet"))]
if let Some(os) = OBJECT_STORE_CACHE_SETTINGS.read().await.clone() {
if let Some(os) = windmill_common::s3_helpers::OBJECT_STORE_CACHE_SETTINGS
.read()
.await
.clone()
{
use crate::global_cache::attempt_fetch_bytes;

if let Ok(mut x) = attempt_fetch_bytes(os, &hash_to_os_path(hash)).await {
if let Err(e) = write_binary_file(bin_path, &mut x).await {
tracing::error!("could not write binary file: {e:?}");
Expand Down

0 comments on commit 8b0f822

Please sign in to comment.