Skip to content

Commit

Permalink
Merge branch 'main' into person/hzhristova/improve-errors-messages-vi…
Browse files Browse the repository at this point in the history
…sibility
  • Loading branch information
hzhristova authored Apr 27, 2023
2 parents f4d0205 + a4d6b7f commit 9927c11
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ spec:
{{- end }}
{{- if .Values.deploymentSupportedPythonVersions }}
- name: DATAJOBS_DEPLOYMENT_SUPPORTED_PYTHON_VERSIONS
value: {{ toJson .Values.deploymentSupportedPythonVersions }}
value: {{ .Values.deploymentSupportedPythonVersions | toJson | quote }}
{{- end }}


Expand Down
25 changes: 24 additions & 1 deletion projects/control-service/projects/model/apidefs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,33 @@ subprojects {
}

task buildPython(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
generatorName = "python"
generatorName = "python-nextgen"
inputSpec = "$projectDir/api.yaml"
outputDir = "$projectDir/build/python"
configFile = "$projectDir/config-python.json"
doLast {

fileTree("$projectDir/build/python/taurus_datajob_api/api") {
}.each { File propFile ->
if(propFile.getName().endsWith("data_jobs_sources_api.py")) {
// Everything in this section can be removed when the ticket(https://github.com/OpenAPITools/openapi-generator/issues/15327) is closed
String content = propFile.getText()
content = content
.replace(
'def sources_upload(self, team_name : Annotated[StrictStr, Field(..., description="Team Name")], job_name : Annotated[StrictStr, Field(..., description="Data Job Name.")], body : StrictStr, reason : Annotated[Optional[StrictStr], Field(description="The reason for executing the request")] = None, **kwargs) -> DataJobVersion: # noqa: E501',
'def sources_upload(self, team_name : Annotated[StrictStr, Field(..., description="Team Name")], job_name : Annotated[StrictStr, Field(..., description="Data Job Name.")], body : bytes, reason : Annotated[Optional[StrictStr], Field(description="The reason for executing the request")] = None, **kwargs) -> DataJobVersion: # noqa: E501').
replace('def sources_upload_with_http_info(self, team_name : Annotated[StrictStr, Field(..., description="Team Name")], job_name : Annotated[StrictStr, Field(..., description="Data Job Name.")], body : StrictStr, reason : Annotated[Optional[StrictStr], Field(description="The reason for executing the request")] = None, **kwargs): # noqa: E501',
'def sources_upload_with_http_info(self, team_name : Annotated[StrictStr, Field(..., description="Team Name")], job_name : Annotated[StrictStr, Field(..., description="Data Job Name.")], body : bytes, reason : Annotated[Optional[StrictStr], Field(description="The reason for executing the request")] = None, **kwargs): # noqa: E501')
propFile.setText(content)
}else if(propFile.getName().endsWith("data_jobs_properties_api.py")) {
// Everything in this section can be removed when the ticket(https://github.com/OpenAPITools/openapi-generator/issues/15328) is closed
String content = propFile.getText()
content = content.
replace("if _params['request_body']:", "if _params['request_body'] is not None:")
propFile.setText(content)
}
}
}
}
cleanUpUnwantedGeneratedFiles.dependsOn 'openApiGenerate'
compileJava.dependsOn 'openApiGenerate' //generate Java from openapi specs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"packageName": "taurus_datajob_api",
"projectName": "vdk-control-service-api",
"verbose": true,
"packageVersion": "1.0.8"
"packageVersion": "1.0.9"
}
2 changes: 1 addition & 1 deletion projects/vdk-control-cli/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ tabulate
urllib3>=1.26.5
vdk-control-api-auth

vdk-control-service-api==1.0.6
vdk-control-service-api==1.0.9
2 changes: 1 addition & 1 deletion projects/vdk-control-cli/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ install_requires =
requests>=2.25
setuptools>=47.0
pluggy
vdk-control-service-api==1.0.6
vdk-control-service-api==1.0.9
tabulate
requests_oauthlib>=1.0
urllib3>=1.26.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_deploy_reason(httpserver: PluginHTTPServer, tmpdir: LocalPath):
uri="/data-jobs/for-team/test-team/jobs/test-job/sources",
method="POST",
headers={"Content-Type": "application/octet-stream"},
query_string="reason=Example+reason",
query_string="reason=Example%20reason",
).respond_with_json(job_version.to_dict())

test_job_path = find_test_resource("test-job")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ def test_execute_with_exception(httpserver: PluginHTTPServer, tmpdir: LocalPath)
assert "what" in result.output and "why" in result.output


def _create_json_serializable_version(execution):
execution = execution.to_dict()
execution["start_time"] = execution["start_time"].isoformat()
return execution


def test_execute_no_execution_id(httpserver: PluginHTTPServer, tmpdir: LocalPath):
rest_api_url = httpserver.url_for("")
team_name = "test-team"
Expand All @@ -187,7 +193,11 @@ def test_execute_no_execution_id(httpserver: PluginHTTPServer, tmpdir: LocalPath
uri=f"/data-jobs/for-team/{team_name}/jobs/{job_name}/executions",
method="GET",
).respond_with_json(
[older_execution.to_dict(), execution.to_dict(), older_execution.to_dict()]
[
_create_json_serializable_version(older_execution),
_create_json_serializable_version(execution),
_create_json_serializable_version(older_execution),
]
)

httpserver.expect_request(
Expand Down

0 comments on commit 9927c11

Please sign in to comment.