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

MIDRC-768 Check if instance type is available in AZ when creating subnets for Nextflow #111

Merged
merged 10 commits into from
Dec 16, 2024

Conversation

jawadqur
Copy link
Contributor

Link to JIRA ticket if there is one:

New Features

Breaking Changes

Bug Fixes

Improvements

  • Run a quick check before creating the subnet to make sure the instance type for nextflow is available in that AZ.

Dependency updates

Deployment changes

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_workspace.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{2}}$$ $$\textcolor{#23d18b}{\tt{2}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link
Contributor

@nss10 nss10 left a comment

Choose a reason for hiding this comment

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

Minor comments, but looks good.

nss10
nss10 previously approved these changes Jun 13, 2024
@paulineribeyre paulineribeyre changed the title Check if instance type is available in AZ when creating subnets for Nextflow MIDRC-768 Check if instance type is available in AZ when creating subnets for Nextflow Jun 13, 2024
Copy link

filepath $$\textcolor{#f14c4c}{\tt{failed}}$$ SUBTOTAL
$$\textcolor{#f14c4c}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$
$$\textcolor{#f14c4c}{\tt{tests/test\_workspace.py}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$
$$\textcolor{#f14c4c}{\tt{TOTAL}}$$ $$\textcolor{#f14c4c}{\tt{2}}$$ $$\textcolor{#f14c4c}{\tt{2}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link
Contributor

@nss10 nss10 left a comment

Choose a reason for hiding this comment

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

Some minor suggestions and questions. Otherwise Looks good to me.

},
{
Name: aws.String("instance-type"),
// TODO: Should this be configurable?
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this TODO: comment? To whom is this question pointed out to?

return nil, fmt.Errorf("Error describing instance type offerings: %v", err)
}
if len(result.InstanceTypeOfferings) > 0 {
Config.Logger.Printf("Debug: Zone: %v has instance type g4dn.xlarge available. Using that for subnet", *zone.ZoneName)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe change this from the hardcoded g4dn.xlarge to {instanceType} variable.

Comment on lines 991 to 992
// TODO: read instance type from config. (MIDRC-751)
subnetId, err := setupSubnet(subnetName, subnetString, vpcid, ec2svc, "t2.micro")
Copy link
Contributor

Choose a reason for hiding this comment

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

This hardcoded string will be changed to a configurable value as a part of a future ticket. Right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, see comment. MIDRC-751

Copy link
Contributor

@paulineribeyre paulineribeyre Jun 21, 2024

Choose a reason for hiding this comment

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

looking at the changes this doesn't look right: setupSubnet's instanceType parameter is the type we want for nextflow jobs instances, it's not the squid instance type we want to configure in MIDRC-751 - it should be g4dn.xlarge not t2.micro. I think you got it confused with this?

so i think it should be:

setupSubnet(... availableInstanceTypes=["g4dn.xlarge"]) <-- get list from config

[...]

// TODO: read instance type from config. (MIDRC-751)
launchSquidInstance(... instanceType="t2.micro")

Copy link
Contributor

@nss10 nss10 Dec 11, 2024

Choose a reason for hiding this comment

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

You are right pauline. This instance type is just indicating the value for the subnet. t2.micro is sent as an argument to setupSubnet only within the setupSquid method (here) whereas setupSubnet method while creating Nextflow Resources uses the instance type that is defined in the hatchery config (here)

Copy link
Contributor

Choose a reason for hiding this comment

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

@nss10 I pushed this change 5542a42 to pass the squid instance type as a parameter instead of hardcoding "t2.micro" twice. Would appreciate if you can check it and maybe test the branch again 🙏

// Make sure the selected AZ has the instance type from nextflow configuration available.
var selectedZone string
for _, zone := range describeZonesOutput.AvailabilityZones {
if *zone.State == "available" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of adding an if condition here checking for availability of an Availability Zone, can we add a filter in the above line?

describeZonesOutput, err := ec2Svc.DescribeAvailabilityZones(&ec2.DescribeAvailabilityZonesInput{})

Note: I haven't looked too deep into the docs, but if the input is used as a filter, maybe that is better than us filtering it ourselves.

Copy link

Please find the ci env pod logs here

Copy link

Please find the ci env pod logs here

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_workspace.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{2}}$$ $$\textcolor{#23d18b}{\tt{2}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ $$\textcolor{#f14c4c}{\tt{failed}}$$ SUBTOTAL
$$\textcolor{#f14c4c}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_workspace.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#f14c4c}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$ $$\textcolor{#f14c4c}{\tt{2}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link
Contributor

@paulineribeyre paulineribeyre left a comment

Choose a reason for hiding this comment

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

Thanks for updating this PR @nss10. I still think this comment hasn't been addressed, i could have misunderstood but could you have a look at it?

Comment on lines 1136 to 1137
// TODO: Should this be configurable?
Values: []*string{aws.String(instanceType)},
Copy link
Contributor

Choose a reason for hiding this comment

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

let's remove the todo

@nss10 nss10 requested a review from paulineribeyre December 11, 2024 22:29
Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

nss10
nss10 previously approved these changes Dec 12, 2024
Copy link
Contributor

@nss10 nss10 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$

Please find the detailed integration test report here

paulineribeyre
paulineribeyre previously approved these changes Dec 12, 2024
}
Config.Logger.Printf("Created new license-user-map item: %v", newItem)

}

allpaymodels, err := getPayModelsForUser(userName)
if err != nil {
Config.Logger.Printf(err.Error())
Config.Logger.Print(err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

If linting issues are also being addressed, shouldn't Line:495 also use Print instead of Printf?

Copy link
Contributor

Choose a reason for hiding this comment

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

That one has been fixed too

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link
Contributor

@paulineribeyre paulineribeyre left a comment

Choose a reason for hiding this comment

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

@nss10 please merge once you have tested the new changes

@nss10 nss10 merged commit b90f371 into master Dec 16, 2024
8 checks passed
@nss10 nss10 deleted the feat/instance-type-az branch December 16, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants