Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(builds): add prewarm ats for builds #1176

Closed
Closed
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
1 change: 1 addition & 0 deletions fern/definition/servers/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ types:
type: optional<boolean>
kind: optional<BuildKind>
compression: optional<BuildCompression>
prewarm_datacenters: optional<list<uuid>>

CreateBuildResponse:
properties:
Expand Down
44 changes: 23 additions & 21 deletions lib/bolt/core/src/context/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,28 +426,30 @@ impl ProjectContextData {
.unwrap();

svc_ctxs_map.insert(svc_ctx.name(), svc_ctx.clone());
} else {
// Read worker
let worker_path = pkg.path().join("worker");
if fs::metadata(&worker_path.join("Service.toml"))
.await
.is_ok()
{
// Load the service
let svc_ctx = context::service::ServiceContextData::from_path(
Weak::new(),
svc_ctxs_map,
&workspace_path,
&worker_path,
)
.await
.unwrap();
svc_ctxs_map.insert(svc_ctx.name(), svc_ctx.clone());
}
}

// Read worker
let worker_path = pkg.path().join("worker");
if fs::metadata(&worker_path.join("Service.toml"))
.await
.is_ok()
{
// Load the service
let svc_ctx = context::service::ServiceContextData::from_path(
Weak::new(),
svc_ctxs_map,
&workspace_path,
&worker_path,
)
.await
.unwrap();
svc_ctxs_map.insert(svc_ctx.name(), svc_ctx.clone());
}

// Load all individual ops
Self::load_services_dir(svc_ctxs_map, &workspace_path, pkg.path().join("ops"))
.await;
// Load all individual ops
let ops_path = pkg.path().join("ops");
if fs::metadata(&ops_path).await.is_ok() {
Self::load_services_dir(svc_ctxs_map, &workspace_path, ops_path).await;
}

// Read standalone
Expand Down
56 changes: 29 additions & 27 deletions lib/bolt/core/src/context/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,33 +510,35 @@ impl ServiceContextData {
);
}

let can_depend =
if self.is_monolith_worker() {
matches!(
dep.config().kind,
ServiceKind::Database { .. }
| ServiceKind::Cache { .. } | ServiceKind::Operation { .. }
| ServiceKind::Package { .. }
| ServiceKind::Consumer { .. }
)
} else if matches!(self.config().kind, ServiceKind::Api { .. }) {
matches!(
dep.config().kind,
ServiceKind::Database { .. }
| ServiceKind::Cache { .. } | ServiceKind::Operation { .. }
| ServiceKind::Package { .. }
| ServiceKind::ApiRoutes { .. }
| ServiceKind::Consumer { .. }
)
} else {
matches!(
dep.config().kind,
ServiceKind::Database { .. }
| ServiceKind::Cache { .. } | ServiceKind::Operation { .. }
| ServiceKind::Package { .. }
| ServiceKind::Consumer { .. }
)
};
let can_depend = if self.is_monolith_worker() {
matches!(
dep.config().kind,
ServiceKind::Database { .. }
| ServiceKind::Cache { .. }
| ServiceKind::Operation { .. }
| ServiceKind::Package { .. }
| ServiceKind::Consumer { .. }
)
} else if matches!(self.config().kind, ServiceKind::Api { .. }) {
matches!(
dep.config().kind,
ServiceKind::Database { .. }
| ServiceKind::Cache { .. }
| ServiceKind::Operation { .. }
| ServiceKind::Package { .. }
| ServiceKind::ApiRoutes { .. }
| ServiceKind::Consumer { .. }
)
} else {
matches!(
dep.config().kind,
ServiceKind::Database { .. }
| ServiceKind::Cache { .. }
| ServiceKind::Operation { .. }
| ServiceKind::Package { .. }
| ServiceKind::Consumer { .. }
)
};

if !can_depend {
panic!(
Expand Down
2 changes: 1 addition & 1 deletion lib/convert/src/impls/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl ApiTryFrom<cluster::types::Datacenter> for models::AdminClustersDatacenter
.map(|p| {
Ok(models::AdminClustersPool {
desired_count: p.desired_count.try_into()?,
drain_timeout: p.drain_timeout.try_into()?,
drain_timeout_ms: p.drain_timeout.try_into()?,
hardware: p
.hardware
.iter()
Expand Down
12 changes: 6 additions & 6 deletions sdks/full/go/admin/clusters/types.go

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

11 changes: 6 additions & 5 deletions sdks/full/go/servers/builds.go

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

8 changes: 4 additions & 4 deletions sdks/full/go/servers/builds/client.go

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

2 changes: 1 addition & 1 deletion sdks/full/go/servers/datacenters/client.go

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

2 changes: 1 addition & 1 deletion sdks/full/go/servers/logs/client.go

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

21 changes: 13 additions & 8 deletions sdks/full/openapi/openapi.yml

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

21 changes: 13 additions & 8 deletions sdks/full/openapi_compat/openapi.yml

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

Loading
Loading