Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ jobs:
env:
QUIET: true
run: cargo make --profile ci ${{ matrix.group.name }}
timeout-minutes: 20
timeout-minutes: 30
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
if: always()
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/golem-cli/src/command_handler/component/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ impl ComponentCommandHandler {
removed_files: changed_files.removed.clone(),
new_file_options: changed_files.merged_file_options(),
config_vars: component_stager.config_vars_if_changed(),
// FIXME: local-agent-config
// FIXME: agent-config
local_agent_config: None,
env: component_stager.env_if_changed(),
agent_types,
Expand Down
2 changes: 2 additions & 0 deletions cli/golem-cli/src/command_handler/worker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,8 @@ impl WorkerCommandHandler {
name: worker_name,
env,
config_vars,
// FIXME: agent-config
local_agent_config: Vec::new(),
},
)
.await
Expand Down
16 changes: 14 additions & 2 deletions cli/golem-cli/wit/deps/golem-1.x/golem-oplog.wit
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package golem:api@1.5.0;
/// Host interface for enumerating and searching for agent oplogs
interface oplog {
use wasi:clocks/wall-clock@0.2.3.{datetime};
use golem:core/types@1.5.0.{value-and-type, account-id, data-value, data-schema};
use golem:core/types@1.5.0.{value-and-type, account-id, data-value, data-schema, wit-value};

use host.{component-revision, oplog-index, persistence-level, environment-id, retry-policy, uuid, agent-id, snapshot};
use context.{attribute, attribute-value, span-id, trace-id};
Expand Down Expand Up @@ -35,6 +35,16 @@ interface oplog {
parameters: list<tuple<string, string>>
}

record raw-local-agent-config-entry {
key: list<string>,
value: wit-value
}

record local-agent-config-entry {
key: list<string>,
value: value-and-type
}

record create-parameters {
timestamp: datetime,
agent-id: agent-id,
Expand All @@ -47,7 +57,8 @@ interface oplog {
component-size: u64,
initial-total-linear-memory-size: u64,
initial-active-plugins: list<plugin-installation-description>,
config-vars: list<tuple<string, string>>
config-vars: list<tuple<string, string>>,
local-agent-config: list<local-agent-config-entry>
}

record host-call-parameters {
Expand Down Expand Up @@ -352,6 +363,7 @@ interface oplog {
initial-total-linear-memory-size: u64,
initial-active-plugins: list<s32>,
config-vars: list<tuple<string, string>>,
local-agent-config: list<raw-local-agent-config-entry>,
original-phantom-id: option<uuid>
}

Expand Down
13 changes: 10 additions & 3 deletions cli/golem-cli/wit/deps/golem-agent/host.wit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package golem:agent@1.5.0;

interface host {
use golem:core/types@1.5.0.{component-id, uuid, promise-id, wit-value};
use golem:core/types@1.5.0.{component-id, uuid, promise-id, wit-value, wit-type};
use wasi:clocks/wall-clock@0.2.3.{datetime};
use wasi:io/poll@0.2.3.{pollable};
use common.{agent-error, agent-type, data-value, registered-agent-type};
Expand Down Expand Up @@ -82,10 +82,17 @@ interface host {
}

/// Get the current value of the config key.
///
/// The expected type is a hint to the host what type of value is expected by the guest and can be used
/// by the host to automatically migrate config values to fit the expected schema.
///
/// Only keys that are declared by the agent-type are allowed to be accessed. Trying
/// to access an undeclared key will trap.
/// to access an undeclared key will trap, unless the expected type is an option. In that case
/// none is returned.
///
/// Getting a local key will get values defined as part of the current
/// component revision + overrides declared during agent creation.
///
/// Getting a shared key will get the current value of the key in the environment.
get-config-value: func(key: list<string>) -> wit-value;
get-config-value: func(key: list<string>, expected-type: wit-type) -> wit-value;
}
16 changes: 16 additions & 0 deletions golem-api-grpc/proto/golem/worker/agent_config.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";

package golem.worker;

import "wasm/rpc/value_and_type.proto";

message LocalAgentConfigEntry {
repeated string key = 1;
// json encoded value
string value = 2;
}

message ParsedLocalAgentConfigEntry {
repeated string key = 1;
wasm.rpc.ValueAndType value = 2;
}
16 changes: 9 additions & 7 deletions golem-api-grpc/proto/golem/worker/public_oplog.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "golem/common/empty.proto";
import "golem/common/environment.proto";
import "golem/common/uuid.proto";
import "golem/component/agent.proto";
import "golem/worker/agent_config.proto";
import "golem/worker/idempotency_key.proto";
import "golem/worker/invocation_context.proto";
import "golem/worker/worker_id.proto";
Expand Down Expand Up @@ -83,13 +84,14 @@ message CreateParameters {
uint64 component_revision = 3;
map<string, string> env = 5;
map<string, string> config_vars = 6;
golem.common.AccountId created_by = 7;
optional WorkerId parent = 8;
uint64 component_size = 9;
uint64 initial_total_linear_memory_size = 10;
repeated PluginInstallationDescription initial_active_plugins = 11;
golem.common.EnvironmentId environment_id = 12;
optional golem.common.UUID original_phantom_id = 13;
repeated ParsedLocalAgentConfigEntry local_agent_config = 7;
golem.common.AccountId created_by = 8;
optional WorkerId parent = 9;
uint64 component_size = 10;
uint64 initial_total_linear_memory_size = 11;
repeated PluginInstallationDescription initial_active_plugins = 12;
golem.common.EnvironmentId environment_id = 13;
optional golem.common.UUID original_phantom_id = 14;
}

message HostCallParameters {
Expand Down
25 changes: 13 additions & 12 deletions golem-api-grpc/proto/golem/worker/v1/worker_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ syntax = "proto3";

package golem.worker.v1;

import "golem/auth/auth_ctx.proto";
import "golem/common/empty.proto";
import "golem/common/revert_worker_response.proto";
import "golem/common/uuid.proto";
import "golem/component/agent.proto";
import "golem/component/component_id.proto";
import "golem/worker/agent_config.proto";
import "golem/worker/complete_parameters.proto";
import "golem/worker/cursor.proto";
import "golem/worker/filesystem.proto";
import "golem/worker/idempotency_key.proto";
import "golem/worker/invocation_context.proto";

import "golem/worker/v1/worker_error.proto";
import "golem/worker/worker_filter.proto";
import "golem/worker/worker_metadata.proto";
import "golem/worker/log_event.proto";
import "golem/worker/oplog_cursor.proto";
import "golem/worker/public_oplog.proto";
import "golem/worker/worker_id.proto";
import "golem/component/component_id.proto";
import "golem/worker/update_mode.proto";
import "golem/worker/filesystem.proto";
import "golem/auth/auth_ctx.proto";
import "golem/component/agent.proto";
import "golem/common/uuid.proto";
import "golem/worker/v1/worker_error.proto";
import "golem/worker/worker_filter.proto";
import "golem/worker/worker_id.proto";
import "golem/worker/worker_metadata.proto";
import "google/protobuf/timestamp.proto";

service WorkerService {
Expand All @@ -37,8 +37,9 @@ service WorkerService {
message LaunchNewWorkerRequest {
golem.component.ComponentId componentId = 1;
string name = 2;
map<string, string> env = 4;
map<string, string> config_vars = 5;
map<string, string> env = 3;
map<string, string> config_vars = 4;
repeated LocalAgentConfigEntry local_agent_config = 5;
bool ignore_already_existing = 6;
golem.auth.AuthCtx auth_ctx = 7;
optional golem.worker.InvocationContext context = 8;
Expand Down
36 changes: 19 additions & 17 deletions golem-api-grpc/proto/golem/workerexecutor/v1/worker_executor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,30 @@ syntax = "proto3";

package golem.workerexecutor.v1;

import "golem/auth/auth_ctx.proto";
import "golem/common/account_id.proto";
import "golem/common/empty.proto";
import "golem/common/environment.proto";
import "golem/common/revert_worker_response.proto";
import "golem/common/uuid.proto";
import "golem/component/agent.proto";
import "golem/component/component_id.proto";
import "golem/shardmanager/shard_id.proto";
import "golem/worker/agent_config.proto";
import "golem/worker/cursor.proto";
import "golem/worker/filesystem.proto";
import "golem/worker/idempotency_key.proto";
import "golem/worker/invocation_context.proto";
import "golem/worker/log_event.proto";
import "golem/worker/promise_id.proto";
import "golem/shardmanager/shard_id.proto";
import "golem/component/component_id.proto";
import "golem/worker/cursor.proto";
import "golem/worker/oplog_cursor.proto";
import "golem/worker/promise_id.proto";
import "golem/worker/public_oplog.proto";
import "golem/worker/update_mode.proto";
import "golem/worker/v1/worker_execution_error.proto";
import "golem/worker/worker_filter.proto";
import "golem/worker/worker_id.proto";
import "golem/worker/worker_metadata.proto";
import "golem/worker/worker_status.proto";
import "golem/worker/worker_filter.proto";
import "golem/worker/v1/worker_execution_error.proto";
import "golem/worker/filesystem.proto";
import "golem/common/environment.proto";
import "golem/common/uuid.proto";
import "golem/auth/auth_ctx.proto";
import "golem/component/agent.proto";
import "google/protobuf/timestamp.proto";

service WorkerExecutor {
Expand Down Expand Up @@ -116,14 +117,15 @@ message CreateWorkerRequest {
golem.worker.WorkerId worker_id = 1;
map<string, string> env = 2;
map<string, string> config_vars = 3;
repeated golem.worker.LocalAgentConfigEntry local_agent_config = 4;
// Account the component belongs to
golem.common.AccountId component_owner_account_id = 4;
golem.common.AccountId component_owner_account_id = 5;
// Component's owner environment
golem.common.EnvironmentId environment_id = 5;
bool ignore_already_existing = 6;
golem.auth.AuthCtx auth_ctx = 7;
optional golem.component.Principal principal = 8;
optional golem.worker.InvocationContext invocation_context = 9;
golem.common.EnvironmentId environment_id = 6;
bool ignore_already_existing = 7;
golem.auth.AuthCtx auth_ctx = 8;
optional golem.component.Principal principal = 9;
optional golem.worker.InvocationContext invocation_context = 10;
}

message CreateWorkerResponse {
Expand Down
5 changes: 5 additions & 0 deletions golem-common/src/base_model/oplog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ use crate::base_model::environment::EnvironmentId;
use crate::base_model::invocation_context::{SpanId, TraceId};
use crate::base_model::regions::OplogRegion;
use crate::base_model::{IdempotencyKey, OplogIndex, Timestamp, TransactionId, WorkerId};
use crate::model::worker::{
ParsedWorkerCreationLocalAgentConfigEntry, UntypedParsedWorkerCreationLocalAgentConfigEntry,
};
use crate::oplog_entry;
use golem_wasm::ValueAndType;
pub use public_types::*;
Expand Down Expand Up @@ -76,6 +79,7 @@ oplog_entry! {
initial_total_linear_memory_size: u64,
initial_active_plugins: HashSet<PluginPriority>,
config_vars: BTreeMap<String, String>,
local_agent_config: Vec<UntypedParsedWorkerCreationLocalAgentConfigEntry>,
original_phantom_id: Option<Uuid>
}
public {
Expand All @@ -89,6 +93,7 @@ oplog_entry! {
initial_total_linear_memory_size: u64,
initial_active_plugins: BTreeSet<PluginInstallationDescription>,
config_vars: BTreeMap<String, String>,
local_agent_config: Vec<ParsedWorkerCreationLocalAgentConfigEntry>,
original_phantom_id: Option<Uuid>
}
},
Expand Down
60 changes: 49 additions & 11 deletions golem-common/src/base_model/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ use golem_wasm_derive::{FromValue, IntoValue};
use std::collections::{BTreeMap, HashMap, HashSet};
use std::fmt::{Display, Formatter};

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "full", derive(poem_openapi::Object))]
#[cfg_attr(feature = "full", oai(rename_all = "camelCase"))]
pub struct WorkerCreationRequest {
pub name: String,
pub env: HashMap<String, String>,
#[cfg_attr(feature = "full", oai(default))]
pub config_vars: BTreeMap<String, String>,
}

declare_enums! {
pub enum FlatComponentFileSystemNodeKind {
Directory,
Expand Down Expand Up @@ -66,7 +55,44 @@ declare_unions! {
}
}

#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(
feature = "full",
derive(IntoValue, FromValue, desert_rust::BinaryCodec)
)]
#[cfg_attr(
feature = "full",
wit(name = "raw-local-agent-config-entry", owner = "golem:api@1.5.0/oplog")
)]
#[cfg_attr(feature = "full", desert(evolution()))]
pub struct UntypedParsedWorkerCreationLocalAgentConfigEntry {
pub key: Vec<String>,
pub value: golem_wasm::Value,
}

declare_structs! {
pub struct WorkerCreationLocalAgentConfigEntry {
pub key: Vec<String>,
pub value: serde_json::Value
}

#[cfg_attr(feature = "full", derive(IntoValue, FromValue, desert_rust::BinaryCodec))]
#[cfg_attr(feature = "full", wit(name = "local-agent-config-entry", owner = "golem:api@1.5.0/oplog"))]
#[cfg_attr(feature = "full", desert(evolution()))]
pub struct ParsedWorkerCreationLocalAgentConfigEntry {
pub key: Vec<String>,
pub value: golem_wasm::ValueAndType
}

pub struct WorkerCreationRequest {
pub name: String,
pub env: HashMap<String, String>,
#[cfg_attr(feature = "full", oai(default))]
pub config_vars: BTreeMap<String, String>,
#[cfg_attr(feature = "full", oai(default))]
pub local_agent_config: Vec<WorkerCreationLocalAgentConfigEntry>
}

pub struct PendingUpdate {
pub timestamp: Timestamp,
pub target_revision: ComponentRevision,
Expand Down Expand Up @@ -127,6 +153,7 @@ declare_structs! {
pub number_of_invocations: u64,
}

// TODO: Rename to AgentFileSystemNode
pub struct FlatComponentFileSystemNode {
pub name: String,
pub last_modified: u64,
Expand All @@ -142,3 +169,14 @@ declare_enums! {
Manual,
}
}

impl From<ParsedWorkerCreationLocalAgentConfigEntry>
for UntypedParsedWorkerCreationLocalAgentConfigEntry
{
fn from(value: ParsedWorkerCreationLocalAgentConfigEntry) -> Self {
Self {
key: value.key,
value: value.value.value,
}
}
}
Loading
Loading