use hostname as worker name

This commit is contained in:
Ruben Fiszel
2023-05-28 19:19:31 +02:00
parent c1d80d91cc
commit 9461b15d43
6 changed files with 32 additions and 21 deletions
+11
View File
@@ -1426,6 +1426,16 @@ dependencies = [
"version_check",
]
[[package]]
name = "gethostname"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818"
dependencies = [
"libc",
"windows-targets 0.48.0",
]
[[package]]
name = "getopts"
version = "0.2.21"
@@ -5096,6 +5106,7 @@ dependencies = [
"chrono",
"dotenv",
"futures",
"gethostname",
"git-version",
"lazy_static",
"once_cell",
+2 -1
View File
@@ -54,7 +54,7 @@ lazy_static.workspace = true
once_cell.workspace = true
prometheus.workspace = true
uuid.workspace = true
gethostname.workspace = true
[dev-dependencies]
serde_json.workspace = true
@@ -163,4 +163,5 @@ once_cell = "1.17.1"
rsmq_async = { version = "5.1.5" }
gosyn = "0.2.2"
bytes = "1.4.0"
gethostname = "0.4.3"
+12 -6
View File
@@ -6,14 +6,14 @@
* LICENSE-AGPL for a copy of the license.
*/
use gethostname::gethostname;
use git_version::git_version;
use monitor::handle_zombie_jobs_periodically;
use sqlx::{Pool, Postgres};
use std::{
net::{IpAddr, Ipv4Addr, SocketAddr},
sync::Arc,
};
use git_version::git_version;
use monitor::handle_zombie_jobs_periodically;
use sqlx::{Pool, Postgres};
use tokio::{
fs::{metadata, DirBuilder},
join,
@@ -282,7 +282,13 @@ pub async fn run_workers<R: rsmq_async::RsmqConnection + Send + Sync + Clone + '
panic!("License key is required ONLY for the enterprise edition");
}
let instance_name = rd_string(5);
let mut instance_name = gethostname()
.to_str()
.map(|x| x.replace(" ", "").to_ascii_lowercase().to_string())
.unwrap_or_else(|| rd_string(5));
instance_name.truncate(12);
let monitor = tokio_metrics::TaskMonitor::new();
let ip = windmill_common::external_ip::get_ip()
@@ -321,7 +327,7 @@ pub async fn run_workers<R: rsmq_async::RsmqConnection + Send + Sync + Clone + '
for i in 1..(num_workers + 1) {
let db1 = db.clone();
let instance_name = instance_name.clone();
let worker_name = format!("dt-worker-{}-{}", &instance_name, rd_string(5));
let worker_name = format!("wk-{}-{}", &instance_name, rd_string(5));
let ip = ip.clone();
let rx = rx.resubscribe();
let base_internal_url = base_internal_url.clone();
+1 -7
View File
@@ -1,10 +1,5 @@
<script lang="ts">
import {
faChevronDown,
faChevronUp,
faDollarSign,
faPlus
} from '@fortawesome/free-solid-svg-icons'
import { faChevronDown, faChevronUp, faPlus } from '@fortawesome/free-solid-svg-icons'
import type { SchemaProperty } from '$lib/common'
import { setInputCat as computeInputCat } from '$lib/utils'
@@ -28,7 +23,6 @@
import StringTypeNarrowing from './StringTypeNarrowing.svelte'
import Toggle from './Toggle.svelte'
import type VariableEditor from './VariableEditor.svelte'
import Popover from './Popover.svelte'
export let label: string = ''
export let value: any
@@ -9,7 +9,6 @@
import ColorInput from './ColorInput.svelte'
import TabSelectInput from './TabSelectInput.svelte'
import { DollarSign } from 'lucide-svelte'
import Popover from '$lib/components/Popover.svelte'
import Toggle from '$lib/components/Toggle.svelte'
import SchemaEditor from '$lib/components/SchemaEditor.svelte'
@@ -533,17 +533,17 @@
{:else}
This workspace is <b>NOT</b> on a team plan. Users use their global free-tier quotas when
doing executions in this workspace. Upgrade to a Team or Enterprise plan to unlock unlimited
execution in this workspace.
executions in this workspace.
{/if}
</div>
<div class="flex flex-col gap-1 mb-4">
<Slider text="What is a computation ?">
<Slider text="What is an execution?">
<Alert type="info" title="A computation is 1s of execution">
The single credit-unit is called a "computation". A computation corresponds to a
single job whose duration is less than 1s. For any additional seconds of computation,
an additional computation is accounted for. Jobs are executed on one powerful virtual
CPU with 2Gb of memory. Most jobs will take less than 200ms to execute.
The single credit-unit is called an "execution". An execution corresponds to a single
job whose duration is less than 1s. For any additional seconds of computation, an
additional execution is accounted for. Jobs are executed on one powerful virtual CPU
with 2Gb of memory. Most jobs will take less than 200ms to execute.
</Alert>
</Slider>