Skip to content

chore: Fix indentation for create_custom_job_psci_sample.py #5498

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

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions samples/model-builder/create_custom_job_psci_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,36 @@ def create_custom_job_psci_sample(
target_project: str,
target_network: str,
):
"""Custom training job sample with PSC Interface Config."""
aiplatform.init(project=project, location=location, staging_bucket=bucket)
"""Custom training job sample with PSC Interface Config."""
aiplatform.init(project=project, location=location, staging_bucket=bucket)

worker_pool_specs = [{
"machine_spec": {
"machine_type": machine_type,
},
"replica_count": replica_count,
"container_spec": {
"image_uri": image_uri,
"command": [],
"args": [],
},
}]
psc_interface_config = {
"network_attachment": network_attachment,
"dns_peering_configs": [
{
"domain": domain,
"target_project": target_project,
"target_network": target_network,
},
],
}
job = aiplatform.CustomJob(
display_name=display_name,
worker_pool_specs=worker_pool_specs,
)
worker_pool_specs = [{
"machine_spec": {
"machine_type": machine_type,
},
"replica_count": replica_count,
"container_spec": {
"image_uri": image_uri,
"command": [],
"args": [],
},
}]
psc_interface_config = {
"network_attachment": network_attachment,
"dns_peering_configs": [
{
"domain": domain,
"target_project": target_project,
"target_network": target_network,
},
],
}
job = aiplatform.CustomJob(
display_name=display_name,
worker_pool_specs=worker_pool_specs,
)

job.run(psc_interface_config=psc_interface_config)
job.run(psc_interface_config=psc_interface_config)


# [END aiplatform_sdk_create_custom_job_psci_sample]
52 changes: 26 additions & 26 deletions samples/model-builder/create_custom_job_psci_sample_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,32 @@ def test_create_custom_job_psci_sample(
mock_get_custom_job,
mock_run_custom_job,
):
"""Custom training job sample with PSC-I through aiplatform_v1beta1."""
create_custom_job_psci_sample.create_custom_job_psci_sample(
project=constants.PROJECT,
location=constants.LOCATION,
bucket=constants.STAGING_BUCKET,
display_name=constants.DISPLAY_NAME,
machine_type=constants.MACHINE_TYPE,
replica_count=1,
image_uri=constants.CONTAINER_URI,
network_attachment=constants.NETWORK_ATTACHMENT_NAME,
domain=constants.DOMAIN,
target_project=constants.TARGET_PROJECT,
target_network=constants.TARGET_NETWORK,
)
"""Custom training job sample with PSC-I through aiplatform_v1beta1."""
create_custom_job_psci_sample.create_custom_job_psci_sample(
project=constants.PROJECT,
location=constants.LOCATION,
bucket=constants.STAGING_BUCKET,
display_name=constants.DISPLAY_NAME,
machine_type=constants.MACHINE_TYPE,
replica_count=1,
image_uri=constants.CONTAINER_URI,
network_attachment=constants.NETWORK_ATTACHMENT_NAME,
domain=constants.DOMAIN,
target_project=constants.TARGET_PROJECT,
target_network=constants.TARGET_NETWORK,
)

mock_sdk_init.assert_called_once_with(
project=constants.PROJECT,
location=constants.LOCATION,
staging_bucket=constants.STAGING_BUCKET,
)
mock_sdk_init.assert_called_once_with(
project=constants.PROJECT,
location=constants.LOCATION,
staging_bucket=constants.STAGING_BUCKET,
)

mock_get_custom_job.assert_called_once_with(
display_name=constants.DISPLAY_NAME,
worker_pool_specs=constants.CUSTOM_JOB_WORKER_POOL_SPECS_WITHOUT_ACCELERATOR,
)
mock_get_custom_job.assert_called_once_with(
display_name=constants.DISPLAY_NAME,
worker_pool_specs=constants.CUSTOM_JOB_WORKER_POOL_SPECS_WITHOUT_ACCELERATOR,
)

mock_run_custom_job.assert_called_once_with(
psc_interface_config=constants.PSC_INTERFACE_CONFIG,
)
mock_run_custom_job.assert_called_once_with(
psc_interface_config=constants.PSC_INTERFACE_CONFIG,
)