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

YNDX implemented provider for YandexCloud #2172

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

elemir
Copy link

@elemir elemir commented Apr 3, 2020

Implemented provider for https://cloud.yandex.com

@elemir
Copy link
Author

elemir commented Apr 6, 2020

Hi!

There is some problem with CLA. @googlebot has used my personal CLA that I signed early, but for this PR we need CLA signed by Yandex LLC

@dlott
Copy link
Contributor

dlott commented Apr 6, 2020

Thanks for the pull request! Can you provide some more details about the CLA issues you mentioned?

@dlott
Copy link
Contributor

dlott commented Apr 6, 2020

Can someone at Yandex add you to [email protected]?

@elemir
Copy link
Author

elemir commented Apr 7, 2020

@dlott, ok, I was added to [email protected], can we rerun @googlebot for using corporate CLA?

@dlott
Copy link
Contributor

dlott commented Apr 7, 2020

@googlebot : rescan

Copy link
Contributor

@dlott dlott left a comment

Choose a reason for hiding this comment

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

This looks like a great start. Can you add some tests?

Also do you have a sample pkb.log from running the cluster_boot benchmark?

@elemir
Copy link
Author

elemir commented Apr 28, 2020

This looks like a great start. Can you add some tests?

Also do you have a sample pkb.log from running the cluster_boot benchmark?

https://gist.github.com/elemir/5113c1473b8480055f32f5ebb304580b

@elemir elemir requested a review from dlott April 29, 2020 14:30
@elemir
Copy link
Author

elemir commented May 14, 2020

@dlott, hi! I'd fixed all review issues, can you review changes again?

Copy link
Contributor

@shyamsabhaya shyamsabhaya left a comment

Choose a reason for hiding this comment

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

Hi elemir,

Thank you for your contribution! Next steps needed to merge PR:

  1. Please sync PR to head
  2. Please add unit tests for the different resources (VM, network, etc - see other clouds as example) - this is to ensure that we do not break any YandexCloud functionality when new code is added to PKB.
  3. Please attach log files to the PR that show successful runs on the cluster_boot, netperf, and ping benchmarks.
  4. Please update functions to use pytype.

Thank you.

'yc_subnet_addr', '10.128.0.0/20', 'Address range to the '
'subnet, given in CDR notation.')
flags.DEFINE_integer(
'yc_core_fraction', None, 'If provided, specifies baseline performance for a core in percent')
Copy link
Contributor

Choose a reason for hiding this comment

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

Lint: Line appears to be too long.

Copy link
Contributor

@cwilkes cwilkes 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 submitting this PR! We're always wanting to run on more clouds.

I'll sheppard your PR through getting approved. Can you run the cluster_boot and netperf benchmarks and attach the logs to the PR? That will help show us that this works as we don't have a yandex account.

from perfkitbenchmarker import flags

flags.DEFINE_string('yc_path', 'yc', 'The path for the yc utility.')
flags.DEFINE_list('additional_yc_flags', [],
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefix all flags for yandex with yc_ . In this case yc_flags_additional

'yc_subnet_zone', None, 'Zone to create subnet in '
'instead of automatically creating one in every zone.')
flags.DEFINE_string(
'yc_subnet_addr', '10.128.0.0/20', 'Address range to the '
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a required flag? For most clouds the subnet is tied to the zone and is automatically assigned. I haven't looked into YC though.

'yc_subnet_addr', '10.128.0.0/20', 'Address range to the '
'subnet, given in CDR notation.')
flags.DEFINE_integer(
'yc_core_fraction', None, 'If provided, specifies baseline performance for a core in percent')
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this percent as in "100" is 100% or is that 1.0? Include an example like "--yc_core_fraction=75 for 3/4 performance"

from perfkitbenchmarker.providers.yandexcloud import yc_machine_types
import six

if six.PY2:
Copy link
Contributor

Choose a reason for hiding this comment

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

We've moved over to be python3 only so you can just use python3 constructs and not use six.

def GetDefaultFolderId():
"""Get the default folder id."""
conf = ParseConfig()
if "folder-id" in conf:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: you can say return conf.get('folder-id') to return None if the key is not in there.

self.id = None

if not self.cores or not self.memory:
raise errors.Config.MissingOption
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you put a message in here like raise errors.Config.MissingOption('Missing cores and/or memory')

with vm_util.NamedTemporaryFile(mode='w', dir=vm_util.GetTempDir(),
prefix='key-metadata') as tf:
tf.write(public_key)
tf.close()
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems a little odd to just read in a file and spit it back out. Can you just use the self.ssh_public_key in the call to GenerateCreateCommand?

util.CheckYcResponseKnownFailures(stderr, retcode)

def _CreateDependencies(self):
super(YcVirtualMachine, self)._CreateDependencies()
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't need to do this unless you are going to also do something in _CreateDependencies() in your code

'describe', self.name)
stdout, _, _ = getinstance_cmd.Issue()
response = json.loads(stdout)
self._ParseDescribeResponse(response)
Copy link
Contributor

Choose a reason for hiding this comment

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

I usually like to log instances like this that will only happen one time and will help with debugging:

logging.info('Created VM %s with internal IP: %s, external IP: %s', self.id, self.internal_ip, self.ip_address)

if self.preemptible:
yc_command = util.YcCommand(
'compute', 'instance', 'list-operations',
'--filter=zone:%s targetLink.scope():%s' % (self.zone, self.name))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this right? It looks a lot like the one for GCP

@AlexMoshkov
Copy link

Hello! Is it relevant to add new providers?
We could update this PR, because it would be interesting to run these tests in our cloud

@s-deitz
Copy link
Member

s-deitz commented Feb 28, 2024

Yes, we can accept PRs to add other cloud providers. We typically cannot test the code so sharing a log of a simple benchmark run would be useful as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants