Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev
This commit is contained in:
@@ -429,7 +429,7 @@ async def update_config_profile(
|
|||||||
if field_name in ("project_id", "tool_type_id"):
|
if field_name in ("project_id", "tool_type_id"):
|
||||||
value = uuid.UUID(value) if value else None
|
value = uuid.UUID(value) if value else None
|
||||||
elif field_name == "mounts" and value is not None:
|
elif field_name == "mounts" and value is not None:
|
||||||
value = [m.model_dump() for m in value]
|
value = [m.model_dump() if not isinstance(m, dict) else m for m in value]
|
||||||
setattr(profile, field_name, value)
|
setattr(profile, field_name, value)
|
||||||
|
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|||||||
@@ -71,13 +71,23 @@ export async function startInstance(
|
|||||||
projectId: string,
|
projectId: string,
|
||||||
repoId: string,
|
repoId: string,
|
||||||
instanceId: string,
|
instanceId: string,
|
||||||
configProfileId?: string
|
configProfileId?: string,
|
||||||
|
retries = 2
|
||||||
): Promise<{ status: string; url?: string }> {
|
): Promise<{ status: string; url?: string }> {
|
||||||
const response = await apiClient.post(
|
try {
|
||||||
`/projects/${projectId}/repositories/${repoId}/instances/${instanceId}/start`,
|
const response = await apiClient.post(
|
||||||
{ config_profile_id: configProfileId }
|
`/projects/${projectId}/repositories/${repoId}/instances/${instanceId}/start`,
|
||||||
);
|
{ config_profile_id: configProfileId }
|
||||||
return response.data;
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error: any) {
|
||||||
|
// Retry on network errors (e.g. Docker creating network interfaces)
|
||||||
|
if (retries > 0 && !error.response) {
|
||||||
|
await new Promise((r) => setTimeout(r, 1500));
|
||||||
|
return startInstance(projectId, repoId, instanceId, configProfileId, retries - 1);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function stopInstance(
|
export async function stopInstance(
|
||||||
@@ -95,13 +105,23 @@ export async function restartInstance(
|
|||||||
projectId: string,
|
projectId: string,
|
||||||
repoId: string,
|
repoId: string,
|
||||||
instanceId: string,
|
instanceId: string,
|
||||||
configProfileId?: string
|
configProfileId?: string,
|
||||||
|
retries = 2
|
||||||
): Promise<{ status: string; url?: string }> {
|
): Promise<{ status: string; url?: string }> {
|
||||||
const response = await apiClient.post(
|
try {
|
||||||
`/projects/${projectId}/repositories/${repoId}/instances/${instanceId}/restart`,
|
const response = await apiClient.post(
|
||||||
{ config_profile_id: configProfileId }
|
`/projects/${projectId}/repositories/${repoId}/instances/${instanceId}/restart`,
|
||||||
);
|
{ config_profile_id: configProfileId }
|
||||||
return response.data;
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error: any) {
|
||||||
|
// Retry on network errors (e.g. Docker creating network interfaces)
|
||||||
|
if (retries > 0 && !error.response) {
|
||||||
|
await new Promise((r) => setTimeout(r, 1500));
|
||||||
|
return restartInstance(projectId, repoId, instanceId, configProfileId, retries - 1);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteInstance(
|
export async function deleteInstance(
|
||||||
|
|||||||
Reference in New Issue
Block a user