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

Fix Background Transpiler Latest Check #1366

Merged
merged 2 commits into from
Mar 18, 2024
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
12 changes: 5 additions & 7 deletions sequencing-server/src/backgroundTranspiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@ export async function backgroundTranspiler(numberOfThreads: number = 2) {
}

// Fetch latest mission model
const { mission_model_aggregate } = await getLatestMissionModel(graphqlClient);
if (!mission_model_aggregate) {
const { mission_model_aggregate: {aggregate: {max: {id: missionModelId} } } } = await getLatestMissionModel(graphqlClient);
if (!missionModelId) {
console.log(
'[ Background Transpiler ] Unable to fetch the latest mission model. Aborting background transpiling...',
);
return;
}

// Fetch latest command dictionary
const { command_dictionary_aggregate } = await getLatestCommandDictionary(graphqlClient);
if (!command_dictionary_aggregate) {
const { command_dictionary_aggregate: {aggregate: {max: {id: commandDictionaryId} } } } = await getLatestCommandDictionary(graphqlClient);
if (!commandDictionaryId) {
console.log(
'[ Background Transpiler ] Unable to fetch the latest command dictionary. Aborting background transpiling...',
);
return;
}

const commandDictionaryId = command_dictionary_aggregate.aggregate.max.id;
const missionModelId = mission_model_aggregate.aggregate.max.id;
const { expansion_rule } = await getExpansionRule(graphqlClient, missionModelId, commandDictionaryId);

if (expansion_rule === null || expansion_rule.length === 0) {
Expand All @@ -51,7 +49,7 @@ export async function backgroundTranspiler(numberOfThreads: number = 2) {
});

const commandTypes = await commandTypescriptDataLoader.load({
dictionaryId: missionModelId,
dictionaryId: commandDictionaryId,
});

if (commandTypes === null) {
Expand Down
2 changes: 1 addition & 1 deletion sequencing-server/src/utils/hasura.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ export async function getExpansionRule(
}>(
gql`
query GetExpansonLogic {
expansion_rule(where: {authoring_command_dict_id: {_eq: ${missionModelId}}, authoring_mission_model_id: {_eq: ${commandDictionaryId} }}) {
expansion_rule(where: {authoring_command_dict_id: {_eq: ${commandDictionaryId}}, authoring_mission_model_id: {_eq: ${missionModelId} }}) {
id
activity_type
expansion_logic
Expand Down