Skip to content

Commit

Permalink
Google Java Format
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and doks5 committed Nov 30, 2023
1 parent 9293d3e commit f3ea160
Show file tree
Hide file tree
Showing 18 changed files with 66 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ paths:
List data Jobs with GraphQL like query. By choosing which field to be returned you can control the output.
You can learn more about the GraphQL queries by visiting [GraphQL official website](https://graphql.org/learn/queries/)
Query should be provided as GET parameter, not by POST body. Don't worry about the spaces and tabs
Keep in mind that each aditional field <b>could make query response time slower, for instance deployments</b>,
Keep in mind that each additional field <b>could make query response time slower, for instance deployments</b>,
it's best if you request only what you need <br/><br/>
The <b>pageNumber</b> and <b>pageSize</b> arguments are required! Page number should be a <b>number greater than 1</b>,
Expand All @@ -102,7 +102,7 @@ paths:
an invalid response will be return.<br/>
* <b>pattern</b> should be a non-empty string which the provided property should contains [ignoring cases], for instance: `starshot` pattern will match
<b>import-starshot-sql, StarShot-servers and notify-starshot</b> job names, but it won't match <b>stars-shot-daily-prune`</b>
If a pattern string is not provided, then you must atleast provide the property field<br/>
If a pattern string is not provided, then you must at least provide the property field<br/>
* <b>sort</b> should be an enum value - ASC (ascending) or DESC (descending) option [not required, default is ASC]
Multiple filters could be applied, but <b>maximum one should contain sorting</b>!
```
Expand Down Expand Up @@ -376,8 +376,8 @@ paths:
<li>5 characters at least
<li>should contain only lowercase alphanumeric symbols and dash [a-z0-9\-]
<br><br>
When succesfully created clients can download the keytab associated with the Data Job to run it locally.<br>
To deploy so that it can be executed reguarly in the runtime environment use /data-jobs/for-team/{team_name}/jobs/{job_name}/deployments API.
When successfully created clients can download the keytab associated with the Data Job to run it locally.<br>
To deploy so that it can be executed regularly in the runtime environment use /data-jobs/for-team/{team_name}/jobs/{job_name}/deployments API.
'/data-jobs/for-team/{team_name}/jobs/{job_name}':
summary: |
Expand Down Expand Up @@ -548,9 +548,9 @@ paths:
parameters:
- name: send_notification
description: |
Allows administrators to disable sending notification during maintance window for platfrom errors -
Allows administrators to disable sending notification during maintenance window for platform errors -
e.g if all jobs are being re-deployed due to migration or after recovering from an outage.
Monitoring data will still be popoulated so deployment status can be monitored by admins.
Monitoring data will still be populated so deployment status can be monitored by admins.
schema:
type: boolean
default: True
Expand All @@ -569,7 +569,7 @@ paths:
summary: Creates or updates a deployment of a Data Job. | (Stable)
description: |
<i>(Introduced in v1.0)</i> | Creates or updates a deployment of a Data Job.
The API returns before the actual Job is deployed (the operation is asynchrounous).
The API returns before the actual Job is deployed (the operation is asynchronous).
Depending on settings specified during Data Job creation, clients will get an e-mail in case of success or failure of the deployment.
If you need to change only deployment settings without changing the job version, use PATCH deployments request which is synchronous.
parameters:
Expand Down Expand Up @@ -632,7 +632,7 @@ paths:
summary: |
Patch a deployment of a Data Job. Use it to change the configuration of a data job.
For example: to enable or disable deployment, to change the vdk version.
The operation is guranteed to be synchrounous so it cannot be used to deploy new version of a data job -
The operation is guaranteed to be synchronous so it cannot be used to deploy new version of a data job -
job_version cannot be changed using PATCH. Use POST .../deployments for this. | (Stable)
description: <i>(Introduced in v1.0)</i>
parameters:
Expand Down Expand Up @@ -818,7 +818,7 @@ paths:
operationId: dataJobLogsDownload
summary: |
Download data job logs.
This API is guranteed to provide logs only if the jobs is currently running.
This API is guaranteed to provide logs only if the jobs is currently running.
For logs from older job executions - use logsUrl field passed by GET execution API or jobsQuery API.
description: <i>(Introduced in v1.2.9)</i>
parameters:
Expand Down Expand Up @@ -902,7 +902,7 @@ paths:

'/data-jobs/for-team/{team_name}/jobs/{job_name}/deployments/{deployment_id}/secrets':
summary: |
Data Job Secrets API allows the management of secrets for specific data jobs. Secreats are any sensitive data:
Data Job Secrets API allows the management of secrets for specific data jobs. Secrets are any sensitive data:
passwords/tokens/credentials which are need by a data job.
get:
tags:
Expand Down Expand Up @@ -1134,10 +1134,10 @@ components:
description: A deployment of the Data Job
type: object
properties:
vdk_version:
description: A specific VDK version to use
vdk_image:
description: A specific VDK image to use
type: string
example: 2.1
example: "example.com/versatiledatakit/vdk:latest"
job_version:
description: Job version (can be Git commit)
type: string
Expand Down Expand Up @@ -1171,10 +1171,10 @@ components:
description: A deployment status of the Data Job, which includes information such as last deployment date, and who deployed the Data Job.
type: object
properties:
vdk_version:
description: A specific VDK version to use
vdk_image:
description: A specific VDK image to use
type: string
example: 2.1
example: "example.com/versatiledatakit/vdk:latest"
job_version:
description: Job version (can be Git commit)
type: string
Expand Down Expand Up @@ -1333,7 +1333,7 @@ components:
example: release

DataJobResources:
description: Resource cofiguration of a data Data Job Deployment.
description: Resource configuration of a data Data Job Deployment.
type: object
properties:
cpu_request:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void verifyVersion() throws Exception {
.with(user("user"))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.vdk_version", is("new_vdk_version_tag")));
.andExpect(jsonPath("$.vdk_image", is("new_vdk_version_tag")));
}

private void resetVdkDeploymentVersion() throws Exception {
Expand Down Expand Up @@ -105,9 +105,9 @@ private void checkDeployment() throws Exception {
Assertions.assertEquals("user", jobDeployment.getLastDeployedBy());
Assertions.assertEquals("3.9", jobDeployment.getPythonVersion());
Assertions.assertFalse(jobDeployment.getEnabled());
Assertions.assertEquals("new_vdk_version_tag", jobDeployment.getVdkVersion());
Assertions.assertEquals("new_vdk_version_tag", jobDeployment.getVdkImage());
Assertions.assertNotNull(jobDeployment.getJobVersion());
Assertions.assertNotNull(jobDeployment.getVdkVersion());
Assertions.assertNotNull(jobDeployment.getVdkImage());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void testDataJobDeploymentDynamicVdkVersion() throws Exception {
// for integration test this is registry.hub.docker.com/versatiledatakit/quickstart-vdk:release
Assertions.assertEquals(
"ghcr.io/versatile-data-kit-dev/versatiledatakit/quickstart-vdk:release",
jobDeployment.getVdkVersion());
jobDeployment.getVdkImage());
Assertions.assertEquals("user", jobDeployment.getLastDeployedBy());
// just check some valid date is returned. It would be too error-prone/brittle to verify exact
// time.
Expand Down Expand Up @@ -225,7 +225,7 @@ public void testDataJobDeploymentDynamicVdkVersion() throws Exception {
.with(user("user"))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.vdk_version", is("new_vdk_version_tag")));
.andExpect(jsonPath("$.vdk_image", is("new_vdk_version_tag")));

// Execute change python version and set corresponding vdk version for deployment
mockMvc
Expand All @@ -247,7 +247,7 @@ public void testDataJobDeploymentDynamicVdkVersion() throws Exception {
Assertions.assertEquals(false, cronJob.getEnabled());
Assertions.assertTrue(cronJob.getImageName().endsWith(testJobVersionSha));
Assertions.assertEquals("user", cronJob.getLastDeployedBy());
Assertions.assertTrue(cronJob.getVdkVersion().endsWith("pre-release"));
Assertions.assertTrue(cronJob.getVdkImage().endsWith("pre-release"));
Assertions.assertEquals("3.8", cronJob.getPythonVersion());

// Execute delete deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public String getDataJobDeploymentEnableRequestBody(boolean enabled)
public String getDataJobDeploymentVdkVersionRequestBody(String vdkVersion)
throws JsonProcessingException {
var deployment = new DataJobDeployment();
deployment.setVdkVersion(vdkVersion);
deployment.setVdkImage(vdkVersion);
return mapper.writeValueAsString(deployment);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static JobDeployment toJobDeployment(
deployment.setResources(jobDeploymentStatus.getResources());
deployment.setMode(jobDeploymentStatus.getMode());
deployment.setGitCommitSha(jobDeploymentStatus.getGitCommitSha());
deployment.setVdkVersion(jobDeploymentStatus.getVdkVersion());
deployment.setVdkImage(jobDeploymentStatus.getVdkImage());
deployment.setPythonVersion(jobDeploymentStatus.getPythonVersion());

return deployment;
Expand All @@ -62,7 +62,7 @@ public static DesiredDataJobDeployment toDesiredDataJobDeployment(JobDeployment

deployment.setGitCommitSha(jobDeployment.getGitCommitSha());
deployment.setPythonVersion(jobDeployment.getPythonVersion());
deployment.setVdkVersion(jobDeployment.getVdkVersion());
deployment.setVdkImage(jobDeployment.getVdkImage());

return deployment;
}
Expand Down Expand Up @@ -165,10 +165,10 @@ public static JobDeployment mergeDeployments(
newDeployment.getGitCommitSha() != null
? newDeployment.getGitCommitSha()
: oldDeployment.getGitCommitSha());
mergedDeployment.setVdkVersion(
(newDeployment.getVdkVersion() != null || newDeployment.getPythonVersion() != null)
? newDeployment.getVdkVersion()
: oldDeployment.getVdkVersion());
mergedDeployment.setVdkImage(
(newDeployment.getVdkImage() != null || newDeployment.getPythonVersion() != null)
? newDeployment.getVdkImage()
: oldDeployment.getVdkImage());
mergedDeployment.setPythonVersion(
newDeployment.getPythonVersion() != null
? newDeployment.getPythonVersion()
Expand Down Expand Up @@ -236,10 +236,10 @@ public static DesiredDataJobDeployment mergeDeployments(
newDeployment.getEnabled() != null
? newDeployment.getEnabled()
: oldDeployment.getEnabled());
mergedDeployment.setVdkVersion(
(newDeployment.getVdkVersion() != null || newDeployment.getPythonVersion() != null)
? newDeployment.getVdkVersion()
: oldDeployment.getVdkVersion());
mergedDeployment.setVdkImage(
(newDeployment.getVdkImage() != null || newDeployment.getPythonVersion() != null)
? newDeployment.getVdkImage()
: oldDeployment.getVdkImage());

return mergedDeployment;
}
Expand Down Expand Up @@ -309,7 +309,7 @@ public static DataJobDeploymentStatus toJobDeploymentStatus(
? null
: actualDataJobDeployment.getLastDeployedDate().toString());
deploymentStatus.setLastDeployedBy(actualDataJobDeployment.getLastDeployedBy());
deploymentStatus.setVdkVersion(actualDataJobDeployment.getVdkVersion());
deploymentStatus.setVdkImage(actualDataJobDeployment.getVdkImage());
return deploymentStatus;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static JobDeployment toJobDeployment(
jobDeployment.setMode(dataJobDeployment.getMode().toString());
}
jobDeployment.setGitCommitSha(dataJobDeployment.getJobVersion());
jobDeployment.setVdkVersion(dataJobDeployment.getVdkVersion());
jobDeployment.setVdkImage(dataJobDeployment.getVdkImage());
if (dataJobDeployment.getPythonVersion() != null) {
jobDeployment.setPythonVersion(dataJobDeployment.getPythonVersion());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2004,11 +2004,13 @@ private Optional<JobDeploymentStatus> mapV1beta1CronJobToDeploymentStatus(
var initContainers =
cronJob.getSpec().getJobTemplate().getSpec().getTemplate().getSpec().getInitContainers();
if (!CollectionUtils.isEmpty(initContainers)) {
// With the functionality to pass custom vdk images that are different from the ones specified
// in the supportedPythonVersions, we need to pass the whole image as a VdkVersion instead of
// With the functionality to pass custom vdk images that are different from the ones
// specified
// in the supportedPythonVersions, we need to pass the whole image as a VdkVersion instead
// of
// just the image tag.
String vdkImage = initContainers.get(0).getImage();
deployment.setVdkVersion(vdkImage);
deployment.setVdkImage(vdkImage);
} else {
log.warn("Missing init container for cronjob {}", cronJobName);
}
Expand Down Expand Up @@ -2068,11 +2070,13 @@ private Optional<JobDeploymentStatus> mapV1CronJobToDeploymentStatus(
var initContainers =
cronJob.getSpec().getJobTemplate().getSpec().getTemplate().getSpec().getInitContainers();
if (!CollectionUtils.isEmpty(initContainers)) {
// With the functionality to pass custom vdk images that are different from the ones specified
// in the supportedPythonVersions, we need to pass the whole image as a VdkVersion instead of
// With the functionality to pass custom vdk images that are different from the ones
// specified
// in the supportedPythonVersions, we need to pass the whole image as a VdkVersion instead
// of
// just the image tag.
String vdkImage = initContainers.get(0).getImage();
deployment.setVdkVersion(vdkImage);
deployment.setVdkImage(vdkImage);
} else {
log.warn("Missing init container for cronjob {}", cronJobName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ private void updateCronJob(DataJob dataJob, JobDeployment jobDeployment, String
"-c",
"cp -r $(python -c \"from distutils.sysconfig import get_python_lib;"
+ " print(get_python_lib())\") /vdk/. && cp /usr/local/bin/vdk /vdk/.");

var jobVdkImage = (jobDeployment.getVdkVersion() != null)
? jobDeployment.getVdkVersion()
var jobVdkImage =
(jobDeployment.getVdkImage() != null)
? jobDeployment.getVdkImage()
: supportedPythonVersions.getVdkImage(jobDeployment.getPythonVersion());

var jobInitContainer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,9 @@ private KubernetesService.CronJob getCronJob(
"-c",
"cp -r $(python -c \"from distutils.sysconfig import get_python_lib;"
+ " print(get_python_lib())\") /vdk/. && cp /usr/local/bin/vdk /vdk/.");
var jobVdkImage = (jobDeployment.getVdkVersion() != null)
? jobDeployment.getVdkVersion()
var jobVdkImage =
(jobDeployment.getVdkImage() != null)
? jobDeployment.getVdkImage()
: supportedPythonVersions.getVdkImage(jobDeployment.getPythonVersion());
var jobInitContainer =
KubernetesService.container(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ public abstract class BaseDataJobDeployment {

private Boolean enabled;

private String vdkVersion;
private String vdkImage;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class JobDeployment {

private String gitCommitSha;

private String vdkVersion;
private String vdkImage;

private String pythonVersion;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ public class JobDeploymentStatus {

private String gitCommitSha;

private String vdkImageName;

private String vdkVersion;
private String vdkImage;

private String pythonVersion;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
alter table if exists desired_data_job_deployment
add column if not exists vdk_version varchar;
add column if not exists vdk_image varchar;
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
alter table if exists actual_data_job_deployment
add column if not exists vdk_version varchar;
add column if not exists vdk_image varchar;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table if exists data_job_execution
rename column vdk_version to vdk_image;
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private ActualDataJobDeployment createActualJobDeployment(DataJob dataJob) {
deployment.setEnabled(true);
deployment.setLastDeployedBy("user");
deployment.setSchedule("sched");
deployment.setVdkVersion("example.com/versatiledatakit/vdk:test-image");
deployment.setVdkImage("example.com/versatiledatakit/vdk:test-image");
var resources = new DataJobDeploymentResources();
resources.setMemoryLimitMi(1);
resources.setMemoryRequestMi(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void testDeploymentPatch_expectDeploymentMerge() {
dataJobsDeploymentController.deploymentPatch("teamName", "jobName", "id", newDeployment);
var patchedJob = desiredJobDeploymentRepository.findById("jobName").get();
Assertions.assertEquals("jobVersion", patchedJob.getGitCommitSha());
Assertions.assertEquals("", patchedJob.getVdkVersion());
Assertions.assertEquals("", patchedJob.getVdkImage());
}

@Test
Expand All @@ -71,12 +71,12 @@ public void testDeploymentPatch_changeVdkVersion() {
desiredJobDeploymentRepository.save(existingDeployment);

var newDeployment = TestUtils.getDataJobDeployment("deploymentId", "jobVersion");
newDeployment.setVdkVersion("newVdkVersion");
newDeployment.setVdkImage("newVdkVersion");

dataJobsDeploymentController.deploymentPatch("teamName", "jobName", "id", newDeployment);

var patchedJob = desiredJobDeploymentRepository.findById("jobName").get();
Assertions.assertEquals("newVdkVersion", patchedJob.getVdkVersion());
Assertions.assertEquals("newVdkVersion", patchedJob.getVdkImage());
}

@Test
Expand Down Expand Up @@ -107,7 +107,7 @@ private DesiredDataJobDeployment getDesiredJobDeployment(DataJob dataJob) {
deployment.setEnabled(true);
deployment.setLastDeployedBy("user");
deployment.setSchedule("sched");
deployment.setVdkVersion("example.com/versatiledatakit/vdk:test-image");
deployment.setVdkImage("example.com/versatiledatakit/vdk:test-image");
var resources = new DataJobDeploymentResources();
resources.setMemoryLimitMi(1);
resources.setMemoryRequestMi(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ public void testPatchDesiredDeployment_changeVdkVersion_expectMergedDeployment()
initialDeployment.setDataJobName(dataJob.getName());
desiredJobDeploymentRepository.save(initialDeployment);
JobDeployment jobDeployment = generateTestDeployment();
jobDeployment.setVdkVersion("new/test/vdkImage");
jobDeployment.setVdkImage("new/test/vdkImage");
deploymentServiceV2.patchDesiredDbDeployment(dataJob, jobDeployment, "user");
var savedDeployment = desiredJobDeploymentRepository.findById("jobName").get();
compareSavedDeploymentWithTestDeployment(jobDeployment, savedDeployment, "user");
Assertions.assertEquals(jobDeployment.getVdkVersion(), savedDeployment.getVdkVersion());
Assertions.assertEquals(jobDeployment.getVdkImage(), savedDeployment.getVdkImage());
}

@AfterEach
Expand Down

0 comments on commit f3ea160

Please sign in to comment.