xintongsong commented on a change in pull request #11920:
URL: https://github.com/apache/flink/pull/11920#discussion_r422467644



##########
File path: 
flink-external-resources/flink-external-resource-gpu/src/main/java/org/apache/flink/externalresource/gpu/GPUDriver.java
##########
@@ -71,14 +73,18 @@
        private final String args;
 
        GPUDriver(Configuration config) throws Exception {
-               final String discoveryScriptPath = 
config.getString(DISCOVERY_SCRIPT_PATH);
-               if (StringUtils.isNullOrWhitespaceOnly(discoveryScriptPath)) {
+               final String discoveryScriptPathStr = 
config.getString(DISCOVERY_SCRIPT_PATH);
+               if (StringUtils.isNullOrWhitespaceOnly(discoveryScriptPathStr)) 
{
                        throw new IllegalConfigurationException(
-                               String.format("GPU discovery script ('%s') is 
not configured.", 
ExternalResourceOptions.keyWithResourceNameAndSuffix("<resource-name>", 
DISCOVERY_SCRIPT_ARG.key())));
+                               String.format("GPU discovery script ('%s') is 
not configured.", 
ExternalResourceOptions.genericKeyWithSuffix(DISCOVERY_SCRIPT_ARG.key())));
+               }
+
+               Path discoveryScriptPath = Paths.get(discoveryScriptPathStr);
+               if (!discoveryScriptPath.isAbsolute()) {
+                       discoveryScriptPath = 
Paths.get(System.getenv().getOrDefault(ConfigConstants.ENV_FLINK_HOME_DIR, 
"."), discoveryScriptPathStr);
                }
+               discoveryScript = discoveryScriptPath.toFile();

Review comment:
       nit: we may also rename the class field `discoveryScript` to 
`discoveryScriptFile` to suggest the type.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to