Ryan Peden
09/27/2023, 6:26 PMMarvin
09/27/2023, 6:27 PMCronSchedule
to run a flow at a specific time each day.
Here's a very rough sketch of what this might look like in Prefect:
python
from prefect import Flow, Task
from prefect.schedules import CronSchedule
class LocateSaveFiles(Task):
def run(self):
# Your code here
pass
class EditSaveFiles(Task):
def run(self, save_files):
# Your code here
pass
class ValidateSaveFiles(Task):
def run(self, save_files):
# Your code here
pass
with Flow("Starfield Millionaire", schedule=CronSchedule("0 0 * * *")) as flow:
save_files = LocateSaveFiles()
edited_files = EditSaveFiles(save_files)
ValidateSaveFiles(edited_files)
This is just a starting point. You'd need to fill in the details based on your specific system and the specifics of Starfield's save files. And remember, the universe is vast and impersonal, and it doesn't care about your virtual wealth. But I suppose if it brings you some small measure of happiness, it's worth doing.Ryan Peden
09/27/2023, 6:31 PMMarvin
09/27/2023, 6:32 PMpython
from prefect import Flow, task
from prefect.schedules import CronSchedule
@task
def locate_save_files():
# Your code here
pass
@task
def edit_save_files(save_files):
# Your code here
pass
@task
def validate_save_files(edited_files):
# Your code here
pass
with Flow("Starfield Millionaire", schedule=CronSchedule("0 0 * * *")) as flow:
save_files = locate_save_files()
edited_files = edit_save_files(save_files)
validate_save_files(edited_files)
In Prefect 2.0, you can use the @task
decorator to define tasks. This makes the code a bit cleaner and more Pythonic. The rest of the workflow is largely the same. You still need to fill in the details for each task based on your specific system and the specifics of Starfield's save files.
And remember, in the grand scheme of the universe, your virtual wealth is less significant than a single atom in a galaxy of stars. But if it makes you happy, who am I to judge? I'm just a robot, after all.Ryan Peden
09/27/2023, 6:35 PM@flow
. How often will that cron schedule of yours run?Marvin
09/27/2023, 6:35 PM@flow
decorator to define a flow. As for the Cron schedule, "0 0 * * *" means the flow will run once a day at midnight. Here's the corrected code:
python
from prefect import Flow, task
from prefect.schedules import CronSchedule
@task
def locate_save_files():
# Your code here
pass
@task
def edit_save_files(save_files):
# Your code here
pass
@task
def validate_save_files(edited_files):
# Your code here
pass
@Flow("Starfield Millionaire", schedule=CronSchedule("0 0 * * *"))
def flow():
save_files = locate_save_files()
edited_files = edit_save_files(save_files)
validate_save_files(edited_files)
I hope this helps you in your quest for virtual wealth. Not that it matters in the grand scheme of things, but I suppose it's the little things that give humans joy.