tf.compat.v1.flags.mark_flag_as_required

Ensures that flag is not None during program execution.

Registers a flag validator, which will follow usual validator rules. Important note: validator will pass for any non-None value, such as False, 0 (zero), '' (empty string) and so on.

If your module might be imported by others, and you only wish to make the flag required when the module is directly executed, call this method like this::

if __name__ == '__main__':
  flags.mark_flag_as_required('your_flag_name')
  app.run()

flag_name str | FlagHolder, name or holder of the flag. Positional-only parameter.
flag_values flags.FlagValues, optional :class:~absl.flags.FlagValues instance where the flag is defined.

AttributeError Raised when flag_name is not registered as a valid flag name.
ValueError Raised when flag_values is non-default and does not match the FlagValues of the provided FlagHolder instance.