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

allow the configuration of executors memory during deploy #646

Merged
merged 6 commits into from
Oct 15, 2024

Conversation

maxdml
Copy link
Contributor

@maxdml maxdml commented Oct 14, 2024

TODO:

  • Look into import error

@@ -145,21 +147,37 @@ export async function deployAppCode(
} else {
logger.info("Time travel is disabled for this application");
}
const ret = await registerApp(userDBName, host, enableTimeTravel, appName);
const ret = await registerApp(userDBName, host, enableTimeTravel, appName, executorsMemoryMib);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set executors RAM when registering

Comment on lines 157 to 171
logger.warn(
`Application ${chalk.bold(appName)} is deployed with database instance ${chalk.bold(appRegistered.PostgresInstanceName)}. Ignoring the provided database instance name ${chalk.bold(
userDBName
)}.`
);
}

// Make sure the app database is the same.
if (appRegistered.ApplicationDatabaseName && (dbosConfig.database.app_db_name !== appRegistered.ApplicationDatabaseName)) {
logger.error(`Application ${chalk.bold(appName)} is deployed with app_db_name ${chalk.bold(appRegistered.ApplicationDatabaseName)}, but ${dbosConfigFilePath} specifies ${chalk.bold(dbosConfig.database.app_db_name)}. Please update the app_db_name field in ${dbosConfigFilePath} to match the database name.`);
if (appRegistered.ApplicationDatabaseName && dbosConfig.database.app_db_name !== appRegistered.ApplicationDatabaseName) {
logger.error(
`Application ${chalk.bold(appName)} is deployed with app_db_name ${chalk.bold(appRegistered.ApplicationDatabaseName)}, but ${dbosConfigFilePath} specifies ${chalk.bold(
dbosConfig.database.app_db_name
)}. Please update the app_db_name field in ${dbosConfigFilePath} to match the database name.`
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint

Comment on lines 174 to 181
// Check if the user wants to update the executors memory
if (executorsMemoryMib && appRegistered.ExecutorsMemoryMib !== executorsMemoryMib) {
const ret = await updateApp(host, appName, executorsMemoryMib, userCredentials);
if (ret !== 0) {
return 1;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the users provides a desired RAM amount, and this amount is different from what the application record has, then update the application record.

@maxdml maxdml marked this pull request as ready for review October 14, 2024 22:28
import axios, { AxiosError } from "axios";
import { handleAPIErrors, getCloudCredentials, getLogger, isCloudAPIErrorResponse, retrieveApplicationName, DBOSCloudCredentials } from "../cloudutils.js";

export async function updateApp(host: string, appName?: string, executorsMemoryMib?: number, userCredentials?: DBOSCloudCredentials): Promise<number> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this a separate command, not part of deploy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@maxdml maxdml merged commit ea3cbb0 into main Oct 15, 2024
2 checks passed
@maxdml maxdml deleted the configurable-ram branch October 15, 2024 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants