ripe-gigabyte-88964
04/14/2023, 2:27 PMIntrinsicError: Side-effects are not allowed in this context: SideEffecting types must be acquired via parameters to `@rule`s.
Has something changed since the guide here was written? Alternatively, is this another case of pants obfuscating the real error message?ripe-gigabyte-88964
04/14/2023, 2:28 PMrun_in_workspace=True
if that mattersenough-analyst-54434
04/14/2023, 2:28 PMripe-gigabyte-88964
04/14/2023, 2:30 PM@goal_rule
async def run_dagster(targets: Targets) -> DagsterGoal:
process_opts, exit_code = [], 0
for target in targets:
if DagsterLocationConfigFieldSet.is_applicable(target):
code_source = target[DagsterLocationCodeSource].value
if "python_file" in code_source:
process_opts.append(f"-f {code_source['python_file']}")
else: # parameter already checks that key is one of either 'python_file' or 'package_name', so safe to assume here
process_opts.append(f"-m {code_source['package_name']}")
if process_opts:
dagster_command = " ".join(("dagster", "dev", *process_opts))
logger.debug(dagster_command)
result = await Effect(
InteractiveProcessResult,
InteractiveProcess(
argv=[dagster_command],
env={"DAGSTER_ENVIRONMENT": "LOCAL_DEV", "DAGSTER_HOME": "/tmp/dagster_home"},
run_in_workspace=True,
),
)
exit_code = result.exit_code
return DagsterGoal(exit_code=exit_code)
Trying to spin up a local dagster serverripe-gigabyte-88964
04/14/2023, 2:33 PMrules
function at the bottom of said file:
def rules():
return [
*collect_rules(),
UnionRule(PackageFieldSet, DagsterLocationConfigFieldSet),
UnionRule(PackageFieldSet, CopyDestinationFieldSet),
]
curved-television-6568
04/14/2023, 2:34 PMawait Get(DagsterGoal, …)
or something like that? (which I would not expect to work)ripe-gigabyte-88964
04/14/2023, 2:36 PMclass RunDagitSubsystem(GoalSubsystem):
name = "run-dagit"
help = "Run dagster locally"
class DagsterGoal(Goal):
subsystem_cls = RunDagitSubsystem
def rules():
return collect_rules()
curved-television-6568
04/14/2023, 2:36 PMenough-analyst-54434
04/14/2023, 2:37 PMWorkspace
parameter to your goal rule for kicks.ripe-gigabyte-88964
04/14/2023, 2:39 PMripe-gigabyte-88964
04/14/2023, 2:39 PMcurved-television-6568
04/14/2023, 2:39 PMcurved-television-6568
04/14/2023, 2:40 PMenough-analyst-54434
04/14/2023, 2:40 PMenough-analyst-54434
04/14/2023, 2:40 PMripe-gigabyte-88964
04/14/2023, 2:40 PM2.16.0rc0
enough-analyst-54434
04/14/2023, 2:41 PMcurved-television-6568
04/14/2023, 2:42 PMripe-gigabyte-88964
04/14/2023, 2:47 PMenough-analyst-54434
04/14/2023, 2:59 PM$ git grep "class Console("
src/python/pants/engine/console.py:class Console(SideEffecting):
If you grep the error message Nick was getting its internals are sneaky.enough-analyst-54434
04/14/2023, 3:04 PM$ git grep "class " | grep "(SideEffecting)"
src/python/pants/engine/console.py:class Console(SideEffecting):
src/python/pants/engine/fs.py:class Workspace(SideEffecting):
src/python/pants/engine/process.py:class InteractiveProcess(SideEffecting):
curved-television-6568
04/14/2023, 3:22 PMcurved-television-6568
04/14/2023, 3:22 PMenough-analyst-54434
04/14/2023, 3:25 PMrun_in_workspace: bool
-> run_in_workspace: Workspace
, but it seems like it deserves a step back and think.