Skip to content

Commit

Permalink
Globally rename whitelist to allowlist
Browse files Browse the repository at this point in the history
  • Loading branch information
chu11 authored and mergify-bot committed Jul 10, 2020
1 parent 4b54941 commit 41ac104
Show file tree
Hide file tree
Showing 23 changed files with 77 additions and 77 deletions.
2 changes: 1 addition & 1 deletion etc/sched-fluxion-resource-start
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# load it via FLUX_RC_EXTRA, the in-tree version can be loaded.

if [ -z ${FLUXION_RESOURCE_RC_NOOP} ]; then
FLUXION_RESOURCE_OPTIONS=${FLUXION_RESOURCE_OPTIONS:-"load-whitelist=node,core,gpu"}
FLUXION_RESOURCE_OPTIONS=${FLUXION_RESOURCE_OPTIONS:-"load-allowlist=node,core,gpu"}
flux module reload -f sched-fluxion-resource ${FLUXION_RESOURCE_OPTIONS}
fi

20 changes: 10 additions & 10 deletions resource/modules/resource_match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ using namespace Flux::resource_model;
struct resource_args_t {
std::string load_file; /* load file name */
std::string load_format; /* load reader format */
std::string load_whitelist; /* load resource whitelist */
std::string load_allowlist; /* load resource allowlist */
std::string match_subsystems;
std::string match_policy;
std::string prune_filters;
Expand Down Expand Up @@ -160,7 +160,7 @@ static void set_default_args (resource_args_t &args)
{
args.load_file = "";
args.load_format = "hwloc";
args.load_whitelist = "";
args.load_allowlist = "";
args.match_subsystems = "containment";
args.match_policy = "high";
args.prune_filters = "ALL:core";
Expand Down Expand Up @@ -222,9 +222,9 @@ static int process_args (std::shared_ptr<resource_ctx_t> &ctx,
args.load_format = dflt;
}
args.load_format = strstr (argv[i], "=") + 1;
} else if (!strncmp ("load-whitelist=",
argv[i], sizeof ("load-whitelist"))) {
args.load_whitelist = strstr (argv[i], "=") + 1;
} else if (!strncmp ("load-allowlist=",
argv[i], sizeof ("load-allowlist"))) {
args.load_allowlist = strstr (argv[i], "=") + 1;
} else if (!strncmp ("subsystems=", argv[i], sizeof ("subsystems"))) {
dflt = args.match_subsystems;
args.match_subsystems = strstr (argv[i], "=") + 1;
Expand Down Expand Up @@ -457,11 +457,11 @@ static int populate_resource_db (std::shared_ptr<resource_ctx_t> &ctx)
__FUNCTION__);
goto done;
}
if (ctx->args.load_whitelist != "") {
if (rd->set_whitelist (ctx->args.load_whitelist) < 0)
flux_log (ctx->h, LOG_ERR, "%s: setting whitelist", __FUNCTION__);
if (!rd->is_whitelist_supported ())
flux_log (ctx->h, LOG_WARNING, "%s: whitelist unsupported",
if (ctx->args.load_allowlist != "") {
if (rd->set_allowlist (ctx->args.load_allowlist) < 0)
flux_log (ctx->h, LOG_ERR, "%s: setting allowlist", __FUNCTION__);
if (!rd->is_allowlist_supported ())
flux_log (ctx->h, LOG_WARNING, "%s: allowlist unsupported",
__FUNCTION__);
}

Expand Down
14 changes: 7 additions & 7 deletions resource/readers/resource_reader_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ using namespace Flux::resource_model;
* *
********************************************************************************/

bool resource_reader_base_t::in_whitelist (const std::string &resource)
bool resource_reader_base_t::in_allowlist (const std::string &resource)
{
return whitelist.empty ()
|| (whitelist.find (resource) != whitelist.end ());
return allowlist.empty ()
|| (allowlist.find (resource) != allowlist.end ());
}


Expand All @@ -58,7 +58,7 @@ resource_reader_base_t::~resource_reader_base_t ()

}

int resource_reader_base_t::set_whitelist (const std::string &csl)
int resource_reader_base_t::set_allowlist (const std::string &csl)
{
if (csl == "")
return 0;
Expand All @@ -72,13 +72,13 @@ int resource_reader_base_t::set_whitelist (const std::string &csl)
while ((pos = csl_copy.find (sep)) != std::string::npos) {
std::string resource = csl_copy.substr (0, pos);
if (resource != "")
whitelist.insert (resource);
allowlist.insert (resource);
csl_copy.erase (0, pos + sep.length ());
}
if (csl_copy != "")
whitelist.insert (csl_copy);
allowlist.insert (csl_copy);
errno = EINVAL;
rc = whitelist.empty ()? -1 : 0;
rc = allowlist.empty ()? -1 : 0;
} catch (std::out_of_range &e) {
errno = EINVAL;
rc = -1;
Expand Down
14 changes: 7 additions & 7 deletions resource/readers/resource_reader_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ class resource_reader_base_t {
const std::string &str, int64_t jobid, int64_t at,
uint64_t dur, bool rsv, uint64_t trav_token) = 0;

/*! Set the whitelist: only resources that are part of this whitelist
/*! Set the allowlist: only resources that are part of this allowlist
* will be unpacked into the graph.
*
* \param csl comma separated whitelist string
* \param csl comma separated allowlist string
* \return 0 on success; non-zero integer on an error
*/
int set_whitelist (const std::string &csl);
int set_allowlist (const std::string &csl);

/*! Is the selected reader format support whitelist
/*! Is the selected reader format support allowlist
*
* \return true when supported
*/
virtual bool is_whitelist_supported () = 0;
virtual bool is_allowlist_supported () = 0;

/*! Return the error message string.
*/
Expand All @@ -106,8 +106,8 @@ class resource_reader_base_t {
void clear_err_message ();

protected:
bool in_whitelist (const std::string &resource);
std::set<std::string> whitelist;
bool in_allowlist (const std::string &resource);
std::set<std::string> allowlist;
std::string m_err_msg = "";
};

Expand Down
2 changes: 1 addition & 1 deletion resource/readers/resource_reader_grug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ int resource_reader_grug_t::update (resource_graph_t &g,
return -1;
}

bool resource_reader_grug_t::is_whitelist_supported ()
bool resource_reader_grug_t::is_allowlist_supported ()
{
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions resource/readers/resource_reader_grug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ class resource_reader_grug_t : public resource_reader_base_t {
const std::string &str, int64_t jobid, int64_t at,
uint64_t dur, bool rsv, uint64_t trav_token);

/*! Is the selected reader format support whitelist
/*! Is the selected reader format support allowlist
*
* \return false
*/
virtual bool is_whitelist_supported ();
virtual bool is_allowlist_supported ();

private:
resource_gen_spec_t m_gspec;
Expand Down
24 changes: 12 additions & 12 deletions resource/readers/resource_reader_hwloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g,
case HWLOC_OBJ_MACHINE: {
// TODO: add signature to support multiple ranks per node
const char *hwloc_name = hwloc_obj_get_info_by_name (obj, "HostName");
if (!hwloc_name || !in_whitelist ("node")) {
if (!hwloc_name || !in_allowlist ("node")) {
supported_resource = false;
break;
}
Expand All @@ -136,7 +136,7 @@ void resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g,
break;
}
case HWLOC_OBJ_GROUP: {
if (!in_whitelist ("group")) {
if (!in_allowlist ("group")) {
supported_resource = false;
break;
}
Expand All @@ -145,7 +145,7 @@ void resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g,
break;
}
case HWLOC_OBJ_NUMANODE: {
if (!in_whitelist ("numanode")) {
if (!in_allowlist ("numanode")) {
supported_resource = false;
break;
}
Expand All @@ -154,7 +154,7 @@ void resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g,
break;
}
case HWLOC_OBJ_PACKAGE: {
if (!in_whitelist ("socket")) {
if (!in_allowlist ("socket")) {
supported_resource = false;
break;
}
Expand All @@ -165,7 +165,7 @@ void resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g,
#if HWLOC_API_VERSION < 0x00020000
case HWLOC_OBJ_CACHE: {
std::string r = "L" + std::to_string (obj->attr->cache.depth) + "cache";
if (!in_whitelist (r)) {
if (!in_allowlist (r)) {
supported_resource = false;
break;
}
Expand All @@ -176,7 +176,7 @@ void resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g,
}
#else
case HWLOC_OBJ_L1CACHE: {
if (!in_whitelist ("L1cache")) {
if (!in_allowlist ("L1cache")) {
supported_resource = false;
break;
}
Expand All @@ -186,7 +186,7 @@ void resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g,
break;
}
case HWLOC_OBJ_L2CACHE: {
if (!in_whitelist ("L2cache")) {
if (!in_allowlist ("L2cache")) {
supported_resource = false;
break;
}
Expand All @@ -196,7 +196,7 @@ void resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g,
break;
}
case HWLOC_OBJ_L3CACHE: {
if (!in_whitelist ("L3cache")) {
if (!in_allowlist ("L3cache")) {
supported_resource = false;
break;
}
Expand All @@ -207,7 +207,7 @@ void resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g,
}
#endif
case HWLOC_OBJ_CORE: {
if (!in_whitelist ("core")) {
if (!in_allowlist ("core")) {
supported_resource = false;
break;
}
Expand All @@ -216,7 +216,7 @@ void resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g,
break;
}
case HWLOC_OBJ_PU: {
if (!in_whitelist ("pu")) {
if (!in_allowlist ("pu")) {
supported_resource = false;
break;
}
Expand All @@ -226,7 +226,7 @@ void resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g,
}
case HWLOC_OBJ_OS_DEVICE: {
if (obj->attr && obj->attr->osdev.type == HWLOC_OBJ_OSDEV_COPROC) {
if (!in_whitelist ("gpu")) {
if (!in_allowlist ("gpu")) {
supported_resource = false;
break;
}
Expand Down Expand Up @@ -370,7 +370,7 @@ int resource_reader_hwloc_t::update (resource_graph_t &g,
return -1;
}

bool resource_reader_hwloc_t::is_whitelist_supported ()
bool resource_reader_hwloc_t::is_allowlist_supported ()
{
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions resource/readers/resource_reader_hwloc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ class resource_reader_hwloc_t : public resource_reader_base_t {
const std::string &str, int64_t jobid, int64_t at,
uint64_t dur, bool rsv, uint64_t trav_token);

/*! Is the hwloc reader format support whitelist
/*! Is the hwloc reader format support allowlist
*
* \return true
*/
virtual bool is_whitelist_supported ();
virtual bool is_allowlist_supported ();

private:
int check_hwloc_version (std::string &m_err_msg);
Expand Down
2 changes: 1 addition & 1 deletion resource/readers/resource_reader_jgf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ int resource_reader_jgf_t::update (resource_graph_t &g,
return rc;
}

bool resource_reader_jgf_t::is_whitelist_supported ()
bool resource_reader_jgf_t::is_allowlist_supported ()
{
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions resource/readers/resource_reader_jgf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ class resource_reader_jgf_t : public resource_reader_base_t {
const std::string &str, int64_t jobid, int64_t at,
uint64_t dur, bool rsv, uint64_t trav_token);

/*! Is the selected reader format support whitelist
/*! Is the selected reader format support allowlist
*
* \return false
*/
virtual bool is_whitelist_supported ();
virtual bool is_allowlist_supported ();

private:
int fetch_jgf (const std::string &str,
Expand Down
2 changes: 1 addition & 1 deletion resource/utilities/command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace resource_model {
struct test_params_t {
std::string load_file; /* load file name */
std::string load_format; /* load reader format */
std::string load_whitelist; /* load resource whitelist */
std::string load_allowlist; /* load resource allowlist */
std::string matcher_name; /* Matcher name */
std::string matcher_policy; /* Matcher policy name */
std::string o_fname; /* Output file to dump the filtered graph */
Expand Down
24 changes: 12 additions & 12 deletions resource/utilities/resource-query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ using namespace Flux::resource_model;
static const struct option longopts[] = {
{"load-file", required_argument, 0, 'L'},
{"load-format", required_argument, 0, 'f'},
{"load-whitelist", required_argument, 0, 'W'},
{"load-allowlist", required_argument, 0, 'W'},
{"match-subsystems", required_argument, 0, 'S'},
{"match-policy", required_argument, 0, 'P'},
{"match-format", required_argument, 0, 'F'},
Expand Down Expand Up @@ -114,8 +114,8 @@ static void usage (int code)
" -f, --load-format=<grug|hwloc|jgf>\n"
" Format of the load file (default=grug)\n"
"\n"
" -W, --load-whitelist=<resource1[,resource2[,resource3...]]>\n"
" Whitelist of resource types to be loaded\n"
" -W, --load-allowlist=<resource1[,resource2[,resource3...]]>\n"
" Allowlist of resource types to be loaded\n"
" Resources that are not included in this list will be filtered out\n"
"\n"
" -S, --match-subsystems="
Expand Down Expand Up @@ -194,7 +194,7 @@ static void set_default_params (std::shared_ptr<resource_context_t> &ctx)
{
ctx->params.load_file = "conf/default";
ctx->params.load_format = "grug";
ctx->params.load_whitelist = "";
ctx->params.load_allowlist = "";
ctx->params.matcher_name = "CA";
ctx->params.matcher_policy = "high";
ctx->params.o_fname = "";
Expand Down Expand Up @@ -465,11 +465,11 @@ static int populate_resource_db (std::shared_ptr<resource_context_t> &ctx)
std::cerr << "ERROR: Can't create load reader " << std::endl;
goto done;
}
if (ctx->params.load_whitelist != "") {
if (rd->set_whitelist (ctx->params.load_whitelist) < 0)
std::cerr << "ERROR: Can't set whitelist" << std::endl;
if (!rd->is_whitelist_supported ())
std::cout << "WARN: whitelist unsupported" << std::endl;
if (ctx->params.load_allowlist != "") {
if (rd->set_allowlist (ctx->params.load_allowlist) < 0)
std::cerr << "ERROR: Can't set allowlist" << std::endl;
if (!rd->is_allowlist_supported ())
std::cout << "WARN: allowlist unsupported" << std::endl;
}

in_file.open (ctx->params.load_file.c_str (), std::ifstream::in);
Expand Down Expand Up @@ -620,11 +620,11 @@ static void process_args (std::shared_ptr<resource_context_t> &ctx,
usage (1);
}
break;
case 'W': /* --hwloc-whitelist */
case 'W': /* --hwloc-allowlist */
token = optarg;
if(token.find_first_not_of(' ') != std::string::npos) {
ctx->params.load_whitelist += "cluster,";
ctx->params.load_whitelist += token;
ctx->params.load_allowlist += "cluster,";
ctx->params.load_allowlist += token;
}
break;
case 'S': /* --match-subsystems */
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/flux-tree
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ apply_policies() {
fi
if [[ "${match_policy}" != "default" ]]
then
export FLUXION_RESOURCE_OPTIONS="hwloc-whitelist=node,core,gpu \
export FLUXION_RESOURCE_OPTIONS="hwloc-allowlist=node,core,gpu \
policy=${match_policy}"
fi
if [[ "x${FT_DRY_RUN}" = "xyes" ]]
Expand Down
2 changes: 1 addition & 1 deletion t/t1002-qmanager-reload.t
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test_expect_success 'qmanager: hwloc reload works' '
test_expect_success 'qmanager: loading resource and qmanager modules works' '
flux module remove sched-simple &&
load_resource prune-filters=ALL:core \
subsystems=containment policy=low load-whitelist=node,socket,core,gpu &&
subsystems=containment policy=low load-allowlist=node,socket,core,gpu &&
load_qmanager
'

Expand Down
2 changes: 1 addition & 1 deletion t/t1003-qmanager-policy.t
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test_expect_success 'qmanager: hwloc reload works' '
test_expect_success 'qmanager: loading qmanager (queue-policy=easy)' '
flux module remove sched-simple &&
load_resource prune-filters=ALL:core \
subsystems=containment policy=low load-whitelist=cluster,node,core &&
subsystems=containment policy=low load-allowlist=cluster,node,core &&
load_qmanager queue-policy=easy
'

Expand Down
Loading

0 comments on commit 41ac104

Please sign in to comment.