GIS 数据处理构建管理器

发布于 2025-01-01 17:30:06 字数 276 浏览 1 评论 0原文

我的组织花费大量时间处理 GIS 数据。我构建了许多 python 脚本来执行数据处理的不同步骤。除了第一个脚本之外,所有脚本都依赖于不同的脚本来完成才能开始。许多脚本需要 5 分钟以上才能执行(其中一个需要一个多小时),因此我不想重复已经执行的步骤。我希望它的工作方式与 Make 类似,这样如果“script3”中发生错误,我不必重新执行“script1”和“script2”。我可以重新运行“script3”。

SCons 是合适的工具吗?我看了一下,它似乎专注于编译代码而不是运行脚本。我愿意接受其他合适的工具。

My organization spends a lot of time processing GIS data. I have built a number of python scripts that perform different steps of the data processing. Other than the first script, all scripts rely on a different script to finish before it can start. Many of the scripts take 5+ minutes to execute (one is over an hour), so I do not want to repeat already-executed steps. I want this to work similar to Make, so that if an error occurs in "script3", I don't have to re-execute "script1" and "script2". I can just re-run "script3".

Is SCons the right tool for this? I looked at it, and it seems to be focused on compiling code rather than running scripts. I'm open to other suitable tools.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

羅雙樹 2025-01-08 17:30:06

我不确定构建系统是您想要的。除非我遗漏了什么,否则您想要的是某种受控自动化来执行处理任务并处理运行时错误。

当然,“make”和“SCons”可以做到这一点,但这就像用火箭筒敲钉子一样。实际上,你忽略了一些从长远来看投入时间学习可能更容易、更有价值的东西,那就是 Python 本身。 Python 是一种成熟的多范式编程语言,具有许多强大的异常处理和与操作系统交互的功能(并且在类 Unix 平台上的系统管理中大量使用)。

第一个简单的步骤是让主脚本调用每个其他脚本,每个脚本都位于 try ... except 块内,并根据您的要求处理异常。您可以通过将脚本重构为一致的 Python 应用程序来改进这一点。

以下是一些开始链接: 链接1链接2

I am not sure a build system is what you want. Unless I am missing something, what you want is some kind of controlled automation to execute your processing tasks, and handle runtime errors.

Of course, 'make' and 'SCons' can do that, but it would be like using a bazooka to hammer a nail. And you're actually overlooking something that might be easier and more rewarding to invest time learning on the long run, which is Python itself. Python is a full-fledged, multi-paradigm programming language, with a lot of features for robust exception handling and interaction with the operating system (and it is heavily used in system administration on Unix-like platforms).

A first simple step would be to have a master script call each of your other scripts, each inside a try ... except block, and handle the exceptions according to your requirements. And you might improve on that as you go along, by refactoring your scripts into a consistent Python application.

Here are some links to start with: link1, link2.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文