[
https://issues.apache.org/jira/browse/YARN-7626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341810#comment-16341810
]
Miklos Szegedi commented on YARN-7626:
--------------------------------------
[~Zian Chen], thank you for the patch.
{code:java}
76 static int is_regex(const char *str) {
77 const char *regex_str = "^[\\^].*[\\$]$";
78 return execute_regex_match(regex_str, str);
79 }{code}
You could just do a simple {{size_t len=strlen(str); return !(len>2 &&
str[0]=='^' && str[len-1]=='$');}} It is probably more efficient than compiling
the regex, etc.
{code:java}
// Iterate each permitted values.{code}
There is a missing 'through' here in the iterate through each value message.
{code:java}
137 if (is_regex(permitted_values[j]) == 0) {
138 ret = validate_volume_name_with_argument(values[i],
permitted_values[j]);
139 }
{code}
I would put {{ret = strncmp(values[i], permitted_values[j], tmp_ptr -
values[i]);}} into the else of this block.
{code:java}
// if it's a valid REGEX return; for user mount, we need to strictly check
{code}
Is not there a contradiction with the code? \{{853 if
(validate_volume_name(mount) == 0) {}}
{code:java}
925 // if (permitted_mounts[i] is a REGEX): use REGEX to compare; return
926 if (is_regex(permitted_mounts[i]) == 0 &&
927 validate_volume_name_with_argument(normalized_path,
permitted_mounts[i]) == 0) {
928 ret = 1;
929 break;
930 }
{code}
Similarly, is not there a contradiction between the code and the comment? If
the comment is right, this check should be before {{if (strcmp(normalized_path,
permitted_mounts[i]) == 0) {}} and break in case of the regex, regardless of
match or not.
{code:java}
979 ret = normalize_mounts(permitted_ro_mounts, -1);
{code}
If {{isUserMount}} is a boolean, I would use 0 or 1. -1 might be misleading to
some folks.
> Allow regular expression matching in container-executor.cfg for devices and
> named docker volumes mount
> ------------------------------------------------------------------------------------------------------
>
> Key: YARN-7626
> URL: https://issues.apache.org/jira/browse/YARN-7626
> Project: Hadoop YARN
> Issue Type: New Feature
> Reporter: Zian Chen
> Assignee: Zian Chen
> Priority: Major
> Attachments: YARN-7626.001.patch, YARN-7626.002.patch,
> YARN-7626.003.patch, YARN-7626.004.patch, YARN-7626.005.patch
>
>
> Currently when we config some of the GPU devices related fields (like ) in
> container-executor.cfg, these fields are generated based on different driver
> versions or GPU device names. We want to enable regular expression matching
> so that user don't need to manually set up these fields when config
> container-executor.cfg,
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]