-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal to enhance tdworkflow with schedule_from parameter #30
Comments
Added on #31. Can you try it before release? |
Awesome, thank you! I'll report back. |
Test scenario
digdag server --memory
import os
from datetime import datetime, timedelta
import requests
import tdworkflow
import yaml
session = requests.Session()
client = tdworkflow.client.Client(
endpoint="localhost:65432", apikey="", _session=session, scheme="http"
)
# current time
current_time = datetime.now()
# sample workflow
workflow = {
"timezone": "Europe/Zurich",
"schedule": {
"daily>": f"{current_time.hour + 1}:{current_time.minute}:{current_time.second}"
},
"+Hello": {"echo>": "Hello"},
}
# mkdir work
def mkproject(project_name, workflow):
project_dir = f"work/{project_name}"
os.makedirs(project_dir, exist_ok=True)
with open(f"{project_dir}/{project_name}.dig", "w") as f:
f.write(yaml.dump(workflow))
return project_dir
# normal
project_name = "normal"
project_update = client.create_project(
project_name=project_name, target_dir=mkproject(project_name, workflow)
)
# schedule_from
time_2_hours_from_now = current_time + timedelta(hours=2)
project_name = "schedulefrom"
project_update = client.create_project(
project_name=project_name,
target_dir=mkproject(project_name, workflow),
schedule_from=time_2_hours_from_now,
) Expected behavior
ResultNormalSchedulefromConclusionThe I noticed that you've also implemented two undocumented (but existing) parameters:
Having those available will come in handy. Thank you very very much. |
Do you happen to know what setting digdag schedules All I've observed was that the |
I don't know much about it, but it looks like it affects handling around the last_session_time. My notation in the docstring may be wrong. |
I've updated the docstring accordingly. 7e0ba33 Looking at here I think it's good time to close this issue. Will release a new version soon. Thanks for your evaluation @ehaupt! |
Thank you for the explanation and the new release. |
I noticed that the PUT /api/projects endpoint in digdag allows passing a schedule_from parameter to specify a future time for starting the scheduling of new workflows. This feature could be really useful for planning in advance.
Would you consider adding support for this parameter in the
client.create_project()
method? I believe it could enhance the functionality of your library, and many users including myself would find it extremely beneficial.Thank you for considering this addition.
The text was updated successfully, but these errors were encountered: