witty-crayon-22786
02/25/2021, 2:04 AMhappy-kitchen-89482
02/25/2021, 2:15 AM./pants
builds optimized, but running rust tests then rebuilds unoptimizedhappy-kitchen-89482
02/25/2021, 2:15 AMenough-analyst-54434
02/26/2021, 12:21 AMhundreds-breakfast-49010
02/26/2021, 10:11 PMhundreds-breakfast-49010
02/26/2021, 10:12 PMwitty-crayon-22786
03/03/2021, 12:06 AMdef get_pyenv_root():
try:
return subprocess.check_output(["pyenv", "root"]).decode().strip()
except (OSError, subprocess.CalledProcessError):
return None
witty-crayon-22786
03/05/2021, 5:52 PMwitty-crayon-22786
03/05/2021, 6:13 PM- [f"--ca-certs-path={certs_file}"], env={"PATH": None, "PYENV_ROOT": None, "HOME": None}
+ [f"--ca-certs-path={certs_file}"], env_inherit={"PATH", "PYENV_ROOT", "HOME"},
witty-crayon-22786
03/05/2021, 8:57 PMPantsEnvironment
? it’s only used internally at this point, afaikhundreds-breakfast-49010
03/06/2021, 2:15 AMhundreds-breakfast-49010
03/07/2021, 10:32 AMWRAPPER_REQUIREMENTS
and WRAPPER_SRCPATH
in the pants repo's pants
file still necessary for anything today?hundreds-breakfast-49010
03/08/2021, 8:28 PMhundreds-breakfast-49010
03/09/2021, 3:24 AMhundreds-father-404
03/09/2021, 6:54 PMpants.log
instead of the console. That means, for example, that making --stats-log
be async in the final call results in the result being written to the file
Would it be possible to have workunit handler plugins write to the console somehow? I don't understand much how that split workshundreds-father-404
03/09/2021, 10:37 PMthread
library?average-vr-56795
03/10/2021, 10:58 PMopen
and having them Just Work?hundreds-father-404
03/12/2021, 5:29 PMStreamingWorkunitHandler.session()
multiple times, rather than only once per StreamingWorkunitHandler
instance? In practice, we only ever call .session()
once in local_pants_runner.py
, but a test calls it twice on the same instance and it's making some perf work I'm doing harder to landchilly-magazine-21545
03/13/2021, 11:31 AMHere’s a rule of thumb for designing good Trio-style (“trionic”?) APIs: if you’re writing a reusable function, then you shouldn’t take a timeout= parameter, and instead let your caller worry about it. This has several advantages. First, it leaves the caller’s options open for deciding how they prefer to handle timeouts – for example, they might find it easier to work with absolute deadlines instead of relative timeouts. If they’re the ones calling into the cancellation machinery, then they get to pick, and you don’t have to worry about it. Second, and more importantly, this makes it easier for others to re-use your code. If you write a http_get function, and then I come along later and write a log_in_to_twitter function that needs to internally make several http_get calls, I don’t want to have to figure out how to configure the individual timeouts on each of those calls – and with Trio’s timeout system, it’s totally unnecessary.
Of course, this rule doesn’t apply to APIs that need to impose internal timeouts. For example, if you write a start_http_server function, then you probably should give your caller some way to configure timeouts on individual requests.
chilly-magazine-21545
03/13/2021, 11:36 AMHere’s the rule: if it’s in the trio namespace, and you use await to call it, then it’s cancellable (see Checkpoints above). Cancellable means:
- If you try to call it when inside a cancelled scope, then it will raise Cancelled.
- If it blocks, and while it’s blocked then one of the scopes around it becomes cancelled, it will return early and raise Cancelled.
- Raising Cancelled means that the operation did not happen. If a Trio socket’s send method raises Cancelled, then no data was sent. If a Trio socket’s recv method raises Cancelled then no data was lost – it’s still sitting in the socket receive buffer waiting for you to call recv again. And so forth.
chilly-magazine-21545
03/13/2021, 11:39 AMIf a cancel scope becomes cancelled before entering its with block, the Cancelled exception will be raised at the first checkpoint inside the with block. This allows a CancelScope to be created in one task and passed to another, so that the first task can later cancel some work inside the second.
Cancel scopes are not reusable or reentrant; that is, each cancel scope can be used for at most one with block. (You’ll get a RuntimeError if you violate this rule.)
chilly-magazine-21545
03/13/2021, 11:39 AMchilly-magazine-21545
03/13/2021, 12:47 PMchilly-magazine-21545
03/13/2021, 12:48 PMAnd now that we know where our cancel+schedule points are, there’s the question of how to effectively communicate this information to the user. We want some way to mark out a category of functions that might block or trigger a task switch, so that they’re clearly distinguished from functions that don’t do this. Wouldn’t it be nice if there were some Python feature, that naturally divided functions into two categories, and maybe put some sort of special syntactic marking on with the functions that can do weird things like block and task switch…? What a coincidence, that’s exactly how async functions work! Rule 4: in Trio, only the potentially blocking functions are async. So e.g. Event.wait() is async, but Event.set() is sync.
hundreds-breakfast-49010
03/15/2021, 5:14 AMhundreds-father-404
03/15/2021, 8:16 PMnative.py
Externs.create_exception()
method with instead using CPython's eval(code: &str)
mechanism, which will reduce FFI boilerplate.
But I'm stuck on escaping of quotes. I'm writing py.eval(&format!("Exception(\"{}\")", msg)
, and it results in a syntax error if msg
has "
in it. We need to modify msg
so that "
is transformed into \"
. I'm not finding a good way to do this in Rust - the best I've thought of is to map over .chars()
and create a new String
?hundreds-father-404
03/16/2021, 12:04 AMsession.product_request()
failing when --dynamic-ui
is enabled but the console has been torn down:
The answer might be to make the "render the UI" flag a per-product_request method call flag, rather than a Session-level flag,Thoughts on keeping the Session-level flag, but then adding a bool override to
ExecutionRequest
to force no console?witty-crayon-22786
03/17/2021, 8:01 PMenough-analyst-54434
03/19/2021, 12:31 AMARCHFLAGS
env var to tests for ci. This appears to require a code change to expand the hardcoded SETTABLE_ENV_VARS
list in src/python/pants/core/util_rules/subprocess_environment.py
. Is that true or am I missing some other way? If it is true is that viewed as good or necessary? It seems I should be able to allow any env var through I want if I go through the effort to set the option.hundreds-father-404
03/19/2021, 12:47 AMread_error_count: BTreeMap<String, usize>
field on remote_cache::CommandRunner
. I think I want to wrap that in a Mutex
? Iiuc, we only have one CommandRunner
ever, but run()
can be called by multiple different threads/tasks.
I don't think I need an Arc
because the type isn't being shared across different values?