function::task_uid - Linux
Overview
function::task_uid retrieves the UID of the underlying OS task for the specified function.
Syntax
function::task_uid(const function& f);
Options/Flags
None.
Examples
namespace gcs = ::google::cloud::storage;
using ::google::cloud::future;
using ::google::cloud::StatusOr;
[](gcs::Client client, std::string const& bucket_name,
std::string const& object_name) {
auto status_or = client.RewriteObjectBlocking(
bucket_name, object_name, bucket_name, object_name + ".copy",
gcs::CustomHeader{"x-goog-task-user-project-id", "my-other-project"});
if (!status_or) throw std::move(status_or).status();
auto const& new_object = *status_or;
std::cout << "New object was created by uid=" << new_object.uid()
<< " for task id=" << function::task_uid(client.last_status()) << "\n";
}
Common Issues
None.
Integration
This command can only be used in a function. It can be used to associate the
function with a specific task. This can be useful for debugging or for
assigning costs to a specific function.