Repository navigation
feat(spider-py): Add job submission support for MariaDB storage backend. #216
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
Merged
sitaowang1998
merged 245 commits into
y-scope:main
from
sitaowang1998:python-job-submission
Sep 4, 2025
Merged
Changes from 243 commits
Commits
Show all changes
245 commits
Select commit
Hold shift + click to select a range
d2ac198
Update yscope-dev-utils
sitaowang1998 cc8a097
Use boost install task
sitaowang1998 7f68bdc
Update install task variable names
sitaowang1998 2394649
Set CMP0074 to NEW to find boost
sitaowang1998 6ff3e33
Add uv to install script
sitaowang1998 7ae8a78
Fix cpp-lint root paths
sitaowang1998 56502f9
Fix clang-tidy file pattern
sitaowang1998 6f6becf
Limit build parallelism
sitaowang1998 a74523d
Bug fix
sitaowang1998 2345d22
Merge branch 'dep-concurrency' into yscope-dev-utils
sitaowang1998 77ee494
Bug fix
sitaowang1998 38b86c8
Merge branch 'dep-concurrency' into yscope-dev-utils
sitaowang1998 3698339
Bug fix
sitaowang1998 369e9f1
Rename variables to mirror CLP core
sitaowang1998 90aa5a2
Rename variables to mirror clp core
sitaowang1998 1769c95
Merge branch 'dep-concurrency' of github.com:sitaowang1998/spider int…
sitaowang1998 edaa834
Merge branch 'dep-concurrency' into yscope-dev-utils
sitaowang1998 7faac8f
Revert "Merge branch 'dep-concurrency' of github.com:sitaowang1998/sp…
sitaowang1998 f494a90
Add comment for deps parallelism default value
sitaowang1998 eb01bb2
Merge branch 'dep-concurrency' into yscope-dev-utils
sitaowang1998 ff2fe1c
Update yscope-dev-utils
sitaowang1998 d476e42
Merge branch 'main' into yscope-dev-utils
sitaowang1998 850126d
Merge branch 'yscope-dev-utils' into python_lint
sitaowang1998 65841a0
Add latest python lint config files
sitaowang1998 8564fc2
Update ruff lint tasks
sitaowang1998 a6e7d29
Fix ruff lint
sitaowang1998 573b448
Fix ruff lint
sitaowang1998 6ad72c3
Bug fix
sitaowang1998 ba7c6e5
Fix ruff
sitaowang1998 209acb1
Fix ruff
sitaowang1998 406b514
Reformat files
sitaowang1998 66892f5
Remove .inc from cpp linting
sitaowang1998 80f0a10
Merge branch 'yscope-dev-utils' into python_lint
sitaowang1998 3186a42
Add mypy and merge lint and test requirements.txt
sitaowang1998 0925938
Fix mysql connection type
sitaowang1998 6936a9b
Fix socket name type
sitaowang1998 7407090
Fix return type from db cursor
sitaowang1998 6a95b24
Fix db cursor return type
sitaowang1998 f29dcba
Fix mypy import untyped
sitaowang1998 453f209
Fix mypy and Popen
sitaowang1998 d1011c7
Fix generator type hint
sitaowang1998 a7dc642
Fix mypy
sitaowang1998 a7d92c2
Fix ruff
sitaowang1998 1c6213b
Simply socket return types.
sitaowang1998 0f13d07
Merge branch 'main' into python_lint
sitaowang1998 14d6326
Merge branch 'python_lint' into mypy_lint
sitaowang1998 55a727a
Add tombi lint tasks
sitaowang1998 c98fea1
Rename cpp build tasks
sitaowang1998 ef64454
Merge branch 'main' into mypy_lint
sitaowang1998 09ba8ad
Merge branch 'main' into tombi
sitaowang1998 4e7237e
Add basic python structure
sitaowang1998 1f944d0
Fix code structure
sitaowang1998 68992fc
Fix ruff lint
sitaowang1998 1127b22
Extend lint tasks to python directory
sitaowang1998 4c51c91
Add python build tasks
sitaowang1998 56878b2
Merge branch 'main' into mypy_lint
sitaowang1998 bb428c9
Merge branch 'mypy_lint' into tombi
sitaowang1998 944bd5e
Merge branch 'tombi' into build-task
sitaowang1998 d75bc15
Merge branch 'build-task' into python_structure
sitaowang1998 4b7eca2
Merge branch 'main' into tombi
sitaowang1998 8ddbda7
Merge branch 'tombi' into build-task
sitaowang1998 0d998ec
Merge branch 'build-task' into python_structure
sitaowang1998 6004d64
Fix yaml lint error
sitaowang1998 bcab5db
Fix tombi lint
sitaowang1998 a50d25a
Remove wrong mypy config
sitaowang1998 fbebb96
Fix typo and format file
sitaowang1998 0322bd5
Use typed msgpack and remove mypy config for msgpack from pyproject
sitaowang1998 2a08155
Update uv lock
sitaowang1998 dd29c23
Add task module
sitaowang1998 570cf2f
Merge branch 'python_structure' into python_task
sitaowang1998 9b2a175
Add data and improve type alias
sitaowang1998 32afe0a
Add task graph and reformat files
sitaowang1998 0b62f73
Merge branch 'main' into tombi
sitaowang1998 7384158
Merge branch 'main' into build-task
sitaowang1998 70ef90a
Merge branch 'main' into python_structure
sitaowang1998 1aae0cb
Merge branch 'main' into python_task
sitaowang1998 2f9b4a0
Fix typo
sitaowang1998 4e080ac
Fix set remove key error
sitaowang1998 b09515c
Increase min version of tombi
sitaowang1998 bad9675
Merge branch 'tombi' into build-task
sitaowang1998 e009ff4
Merge branch 'tombi' into python_structure
sitaowang1998 f11a3b6
Merge branch 'python_structure' into python_task
sitaowang1998 a0407a7
Merge branch 'main' into tombi
sitaowang1998 aa9a8de
Merge branch 'tombi' into build-task
sitaowang1998 3c7e794
Merge branch 'tombi' into python_structure
sitaowang1998 ca4ec29
Merge branch 'python_structure' into python_task
sitaowang1998 b4d6576
Add uv in README
sitaowang1998 23f31cd
Merge branch 'main' into build-task
sitaowang1998 0167ac0
Merge branch 'build-task' into python_structure
sitaowang1998 5a9cb76
Merge branch 'python_structure' into python_task
sitaowang1998 f447614
Fix redenduncy caused by merge
sitaowang1998 a84de83
Merge branch 'build-task' into python_structure
sitaowang1998 f94460f
Merge branch 'python_structure' into python_task
sitaowang1998 2d1b6fc
Merge branch 'main' into python_structure
sitaowang1998 5a35122
Merge branch 'main' into python_task
sitaowang1998 061d101
Merge branch 'main' into python_structure
sitaowang1998 451a80e
Merge branch 'main' into python_task
sitaowang1998 de149ee
Add integral types
sitaowang1998 d332dbe
Revert "Add integral types"
sitaowang1998 80b6772
Add package export control for type
sitaowang1998 f2ebaa6
Add floating point type
sitaowang1998 8c27b16
Restructure under src/spider
sitaowang1998 1b7ab77
Merge branch 'python_structure' into python_task
sitaowang1998 b7f1884
Merge branch 'python_structure' into python_type
sitaowang1998 a7aa6b0
Re-export spider.type under spider
sitaowang1998 95b98c8
Merge branch 'main' into python_structure
sitaowang1998 e7b119c
Merge branch 'main' into python_task
sitaowang1998 8ffbd03
Fix import path
sitaowang1998 5765acf
Add tdl types; Allow no docstring for override function
sitaowang1998 427dd6b
Merge branch 'main' into python_structure
sitaowang1998 a9c9e57
Merge branch 'main' into python_task
sitaowang1998 213d2fc
Add type conversion to tdl type
sitaowang1998 a1a86f3
Add to_tdl_str
sitaowang1998 97af71b
Add to_tdl_type_str to type package export
sitaowang1998 74f31e2
Add pytest and basic test structure
sitaowang1998 7d95706
Add python test tasks
sitaowang1998 96b5324
Rename some cpp tests and add python tests to GH workflow and doc
sitaowang1998 14ea6fb
Don't create __pycache__ when running pytest
sitaowang1998 854cd11
Fix missing link
sitaowang1998 5565c9e
Merge branch 'python_structure' of github.com:sitaowang1998/spider in…
sitaowang1998 a9791e5
Merge branch 'python_structure' into python_task
sitaowang1998 2504429
Merge branch 'python_structure' into python_test_setup
sitaowang1998 7ea4928
Use task env
sitaowang1998 01dd0c6
Fix task executor path
sitaowang1998 c6ccce6
Merge branch 'python_structure' into python_task
sitaowang1998 4cec09b
Merge branch 'python_structure' into python_test_setup
sitaowang1998 e022404
Merge branch 'main' into python_structure
sitaowang1998 8894b90
Merge branch 'main' into python_test_setup
sitaowang1998 01c9c64
Merge branch 'main' into python_task
sitaowang1998 7753153
Merge branch 'main' into python_structure
sitaowang1998 dd59915
Merge branch 'main' into python_test_setup
sitaowang1998 b86d47c
Merge branch 'main' into python_task
sitaowang1998 ac1d4ee
Merge branch 'python_structure' into python_type
sitaowang1998 0d38c43
Merge branch 'python_test_setup' into python_type
sitaowang1998 438f6e7
Remove unnecessary __init__.py files
sitaowang1998 2caad5d
Merge branch 'python_structure' into python_test_setup
sitaowang1998 c6815ce
Merge branch 'python_test_setup' into python_type
sitaowang1998 61e0651
Fix bugs
sitaowang1998 8b13abd
Add some type convertion tests
sitaowang1998 50b2b25
Bug fix
sitaowang1998 519dcd8
Merge branch 'python_test_setup' into python_type
sitaowang1998 8e2786b
Add more tests
sitaowang1998 a8c8641
Fix pytest
sitaowang1998 9fabc44
Merge branch 'python_test_setup' into python_type
sitaowang1998 e558f67
Improve code according to coderabbit
sitaowang1998 09d3fd0
Merge branch 'python_type' into python_client_task
sitaowang1998 ae2a935
Add reset id
sitaowang1998 008c6fb
Export core
sitaowang1998 cd60dc6
Merge branch 'python_task' into python_client_task
sitaowang1998 720265f
Add client task graph
sitaowang1998 ebe64c6
Add client taskgraph to spider export
sitaowang1998 404cf3b
Excempt _impl from private access check
sitaowang1998 3f9fe04
Add basic TaskFunction defintion
sitaowang1998 4d10f88
"Add default values for tasks"
sitaowang1998 fe4121f
Merge branch 'python_task' into python_client_task
sitaowang1998 f3ac001
Fix task IO type and add create_task from function
sitaowang1998 95b7773
Add client task group
sitaowang1998 a72e4a6
Add task graph chain
sitaowang1998 f289e5a
Reset ids after chain
sitaowang1998 2e829bc
Add export
sitaowang1998 ec6802d
Export TaskContext
sitaowang1998 3685dd7
Add unit tests
sitaowang1998 2862f01
Fix tuple check
sitaowang1998 03af08d
Fix size check in chain
sitaowang1998 c3dda18
Fix chain dependencies
sitaowang1998 2a1f33e
Fix id collision
sitaowang1998 0e4452c
Add more tests and more fixes
sitaowang1998 3705ef3
Satisfy ruff
sitaowang1998 fb8938a
Satisfy mypy
sitaowang1998 9ed09be
Bug fix
sitaowang1998 ef827a3
Remove unnecessary reset_ids
sitaowang1998 220a2b0
Fix task input id reset
sitaowang1998 56f7866
Fix comment grammar
sitaowang1998 638d577
Fix tuple check
sitaowang1998 2bcc4a4
Add guard for function with no argument
sitaowang1998 aa1723e
Disallow varargs in task function
sitaowang1998 2469008
Disallow variable tuple return in task function
sitaowang1998 082476d
Use identity check for Parameter.empty sentinel
sitaowang1998 72239f7
Fix error msg for ruff
sitaowang1998 e13acec
Make create_task private
sitaowang1998 84a6256
Split create_task into multiple functions
sitaowang1998 c45eb0d
Add storage cursor
sitaowang1998 1a27b45
Add storage connection interface
sitaowang1998 b505e06
Use functionality as storage interface
sitaowang1998 44067ab
Add jdbc url
sitaowang1998 c81719b
Add mariadb connection
sitaowang1998 899189e
Add submit job sql
sitaowang1998 ba1fd69
Add driver id
sitaowang1998 fe4b24b
Add export of driver id
sitaowang1998 8c0125a
Add submit job db function
sitaowang1998 beb4b5f
Add tests for mariadb
sitaowang1998 ff8bb01
Fix jdbc url
sitaowang1998 43de342
Add mariadb test
sitaowang1998 6b06a30
Split python tests into storage and non-storage
sitaowang1998 8faa0c6
Add more complex graph
sitaowang1998 fe904b0
Bug fix
sitaowang1998 2f1c430
Merge branch 'python_client_task' into python-job-submission
sitaowang1998 e1b1ac3
Bug fix
sitaowang1998 75793de
Bug fix
sitaowang1998 72a0920
Bug fix
sitaowang1998 2b5405a
Bug fix
sitaowang1998 fecdc68
Bug fix
sitaowang1998 3938934
Bug fix
sitaowang1998 eebcab7
Fix docstring typo
sitaowang1998 5e2175a
Fix dict get default value
sitaowang1998 bff3a95
Reformat pyporject.toml
sitaowang1998 e0fd981
Use not list instead of len(list) > 0
sitaowang1998 08ce667
Restructure code to perpare for merge
sitaowang1998 4dc9623
Merge branch 'main' into python_client_task
sitaowang1998 ff76756
Style improvement
sitaowang1998 b9607ae
Use index instead of uuid to identify task in graph
sitaowang1998 75c8b76
Rename files
sitaowang1998 b95af57
Restructure to prepare for merge
sitaowang1998 e81c509
Merge branch 'python_client_task_index' into python-job-submission
sitaowang1998 d19fda2
Use updated task graph structure
sitaowang1998 afa7898
Bug fix
sitaowang1998 8e98c1e
Fix task input refs
sitaowang1998 fe306bc
Add test for task input output ref size
sitaowang1998 d0fb7e2
Avoid deep copy tasks
sitaowang1998 6fe936d
Fix chain task input output refs
sitaowang1998 82dab16
Merge branch 'main' into python_client_task
sitaowang1998 5ef3520
Add spider-py unit test tasks
sitaowang1998 395d46c
Add spider-py unit test tasks
sitaowang1998 b879134
Revert "Add spider-py unit test tasks"
sitaowang1998 1d6e28e
Merge branch 'python_client_task' into python-job-submission
sitaowang1998 7d41718
Merge branch 'main' into python-job-submission
sitaowang1998 67d3709
Fix ruff check
sitaowang1998 ef342cd
Fix task style based on review
sitaowang1998 69adf5a
Remove unpack for InputOutputRef
sitaowang1998 582abf6
Move sql parameter generation into separate functions
sitaowang1998 ec2d1d4
Apply suggestions from code review
sitaowang1998 413b3c8
Rename helper functions and move them after the public funciton
sitaowang1998 5f8ae0e
Update readme to add storage unit tests
sitaowang1998 9d19fff
Fix typo
sitaowang1998 6795c29
Format README.
LinZhihao-723 5b3dd17
Apply suggestions from code review
sitaowang1998 d0c3049
Rename functions
sitaowang1998 383373f
Add docstring and type annotation
sitaowang1998 86b318e
Initialize the ids explicitly
sitaowang1998 961018a
Merge branch 'python-job-submission' of github.com:sitaowang1998/spid…
sitaowang1998 890b620
Fix jdbc url docstring
sitaowang1998 6384fbb
USer urlparse to parse jdbc urls
sitaowang1998 2e91ced
Bug fix
sitaowang1998 67a55ef
Add detailed instruction on how to set up tables
sitaowang1998 4ffec6d
Apply code review
sitaowang1998 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
sitaowang1998 marked this conversation as resolved.
Resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed offline, let's add a sentence to explain how to set up the DB. We don't have the scheduler ready as it's not the integration test. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| """Spider core Driver module.""" | ||
|
|
||
| from uuid import UUID | ||
|
|
||
| DriverId = UUID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| """Spider Storage package.""" | ||
|
|
||
| from .jdbc_url import JdbcParameters, parse_jdbc_url | ||
| from .mariadb_storage import MariaDBStorage | ||
| from .storage import Storage, StorageError | ||
|
|
||
| __all__ = [ | ||
| "JdbcParameters", | ||
| "MariaDBStorage", | ||
| "Storage", | ||
| "StorageError", | ||
| "parse_jdbc_url", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| """JDBC URL module.""" | ||
|
|
||
| import urllib.parse | ||
| from dataclasses import dataclass | ||
|
|
||
|
|
||
| @dataclass | ||
| class JdbcParameters: | ||
| """JDBC url parameters.""" | ||
|
|
||
| protocol: str | ||
| host: str | ||
| database: str | ||
| port: int | None = None | ||
| user: str | None = None | ||
| password: str | None = None | ||
|
|
||
|
|
||
| _JdbcPrefix = "jdbc:" | ||
|
|
||
|
|
||
| def parse_jdbc_url(url: str) -> JdbcParameters: | ||
|
sitaowang1998 marked this conversation as resolved.
Resolved
|
||
| """ | ||
| Parses a JDBC URL. | ||
| :param url: | ||
| :return: Parsed JDBC parameters. | ||
|
sitaowang1998 marked this conversation as resolved.
Resolved
|
||
| :raises ValueError: If the JDBC URL is invalid. | ||
| """ | ||
| protocol_prefix = "" | ||
| if url.startswith(_JdbcPrefix): | ||
| url = url.removeprefix(_JdbcPrefix) | ||
| protocol_prefix = _JdbcPrefix | ||
| parsed = urllib.parse.urlparse(url) | ||
|
sitaowang1998 marked this conversation as resolved.
Resolved
|
||
|
|
||
| msg = "Invalid JDBC URL: {}. Missing {}." | ||
| if not parsed.scheme: | ||
| raise ValueError(msg.format(url, "protocol")) | ||
| if not parsed.hostname: | ||
| raise ValueError(msg.format(url, "host")) | ||
| if not parsed.path or not parsed.path.lstrip("/"): | ||
| raise ValueError(msg.format(url, "database")) | ||
|
|
||
| database = parsed.path.lstrip("/") | ||
| query_params = urllib.parse.parse_qs(parsed.query) | ||
| user = query_params.get("user", [None])[0] | ||
| password = query_params.get("password", [None])[0] | ||
|
|
||
| return JdbcParameters( | ||
| protocol=protocol_prefix + parsed.scheme, | ||
| host=parsed.hostname, | ||
| port=parsed.port, | ||
| database=database, | ||
| user=user, | ||
| password=password, | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: what's the plan for the storage tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean storage tests in GH workflows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Are we planning to add this to our workflows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were talks about it, but no concrete plans. I don't think this is very hard to implement, but we do need to sync the test jdbc url across C++ and Python as they are different right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I think we should set it up ASAP. Let's prioritize this after ur're done with compression integration.