Hadron / Hadron/carthage

Extra calls to check_completed_func after SetupTask is run

Open
#118 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11
Forks
8
Avg merge
9h 26m
Merged PRs (30d)
6

Description

It appears the check_completed_func is called again after carthage has just run a setup task. This seems wrong.

Output detailing multiple calls to check_completed_func from running layout:
```
PYTHONPATH=/home/srak/project/locallayout/carthage: /home/srak/project/locallayout/carthage/bin/carthage-runner --no-pull-plugins --no-tmux . --command-verbose --tasks-verbose --generate
Carthage console. Type Python expressions or use !help for Carthage commands.
>>> !deploy localhost -y
: process started
Task Touch a file source modified at 2025-07-11T04:57:32.178738 more recently than last run of 1969-12-31T19:00:00.
Running cust task for
: process started
Task Touch a file source modified at 2025-07-11T04:57:32.178738 more recently than last run of 1969-12-31T19:00:00.
Running Touch a file task for
: process started
Finished running Touch a file task for from 05:00:44.766125 to 05:00:44.771827 (0:00:00.005702)
Finished running cust task for from 05:00:44.753085 to 05:00:44.774049 (0:00:00.020964)
: process started
Task Touch a file for determined complete by check_completed_func(); no timestamp provided
Running cust task for
: process started
Task Touch a file for determined complete by check_completed_func(); no timestamp provided
Finished running cust task for from 05:00:44.785275 to 05:00:44.795789 (0:00:00.010514)

# Deployment Report

Ran deploy on the following objects successfully:

*

Successful deploy successes:1
>>>
```

MVE layout to reproduce:
```
import sh

from carthage import *
from carthage.modeling import *
from carthage.network import V4Config
from carthage.local import LocalMachine

class layout(CarthageLayout):
layout_name = "testlayout"

add_provider(machine_implementation_key, dependency_quote(LocalMachine))

class localhost(MachineModel):
name = "localhost"

class cust(MachineCustomization):
@setup_task("Touch a file")
async def touch_file(self):
await self.run_command("touch", "/tmp/foo")
@touch_file.check_completed()
async def touch_file(self):
try:
await self.run_command("ls", "/tmp/foo")
return True
except sh.ErrorReturnCode_2:
return False

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided MVE layout and reproduce the deploy using the setup_task and check_completed() definitions on MachineCustomization. Trace the calls reported around SetupTask completion and check_completed_func, then verify that the completed task is not checked again after setup runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.