-
Notifications
You must be signed in to change notification settings - Fork 119
perf: Parallelize all items by central encapsulation into base classes #761
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
Open
mdrakiburrahman
wants to merge
26
commits into
microsoft:main
Choose a base branch
from
mdrakiburrahman:dev/mdrrahman/parallelize-everything
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 22 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
e4e074b
Docs
mdrakiburrahman ed9dfba
Bring in changes from previous branch
mdrakiburrahman 2da3f41
Factor out exclude
mdrakiburrahman 05ade34
Make API mapping a constant
mdrakiburrahman c7bfdcb
Encapsulate environments and pipelines better
mdrakiburrahman 2a21653
Unnecessary change
mdrakiburrahman b71024b
Push more logic into the base publisher
mdrakiburrahman 3282403
Whitespace
mdrakiburrahman 4e76a5f
Factor out dupe logic for validate_items_to_include
mdrakiburrahman 0d4bf0c
English
mdrakiburrahman f19a476
Missed one
mdrakiburrahman 1c35265
Merge origin/main into dev/mdrrahman/parallelize-everything
mdrakiburrahman 4104c4f
Remove unused feature flag
mdrakiburrahman 7ddd4d0
Make validate_experimental_param generic
mdrakiburrahman 0cc63be
Prefix with item type
mdrakiburrahman 8edc409
Lint fix
mdrakiburrahman feee24c
Remove location output for terminal
mdrakiburrahman 11a6175
Update tracer to be thread safe with OS agnostic file locker
mdrakiburrahman d332147
Lint
mdrakiburrahman e3f3da8
Remove orgapp support as of https://github.com/microsoft/fabric-cicd/…
mdrakiburrahman 33f1230
Reorder functions, public first
mdrakiburrahman 6bf1b45
Docstrings
mdrakiburrahman d889839
Merge branch 'main' into dev/mdrrahman/parallelize-everything
mdrakiburrahman 659c259
Restore formatting to how it used to be but add item and name into fu…
mdrakiburrahman fbc25e6
Merge branch 'main' into dev/mdrrahman/parallelize-everything
shirasassoon 943210a
Swallow error into log
mdrakiburrahman 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
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,64 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| """Cross-platform file locking.""" | ||
|
|
||
| import sys | ||
| from pathlib import Path | ||
| from types import TracebackType | ||
| from typing import Callable, Optional, TypeVar | ||
|
|
||
| T = TypeVar("T") | ||
|
|
||
|
|
||
| class FileLock: | ||
mdrakiburrahman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """File lock context manager.""" | ||
|
|
||
| def __init__(self, lock_file: str) -> None: | ||
| self.lock_path = Path(f"{lock_file}.lock") | ||
| self._lock_file: Optional[object] = None | ||
|
|
||
| def __enter__(self) -> "FileLock": | ||
| self._lock_file = self.lock_path.open("w") | ||
| if sys.platform == "win32": | ||
| import msvcrt | ||
|
|
||
| msvcrt.locking(self._lock_file.fileno(), msvcrt.LK_LOCK, 1) | ||
| else: | ||
| import fcntl | ||
|
|
||
| fcntl.flock(self._lock_file.fileno(), fcntl.LOCK_EX) | ||
| return self | ||
|
|
||
| def __exit__( | ||
| self, | ||
| exc_type: Optional[type[BaseException]], | ||
| exc_val: Optional[BaseException], | ||
| exc_tb: Optional[TracebackType], | ||
| ) -> bool: | ||
| if self._lock_file: | ||
| if sys.platform == "win32": | ||
| import msvcrt | ||
|
|
||
| msvcrt.locking(self._lock_file.fileno(), msvcrt.LK_UNLCK, 1) | ||
| else: | ||
| import fcntl | ||
|
|
||
| fcntl.flock(self._lock_file.fileno(), fcntl.LOCK_UN) | ||
| self._lock_file.close() | ||
| return False | ||
|
|
||
| @staticmethod | ||
| def run_with_lock(lock_file: str, func: Callable[[], T]) -> T: | ||
| """ | ||
| Execute a function while holding an exclusive file lock. | ||
|
|
||
| Args: | ||
| lock_file: Path to the file to lock (a .lock suffix will be added) | ||
| func: The function to execute while holding the lock | ||
|
|
||
| Returns: | ||
| The return value of the function | ||
| """ | ||
| with FileLock(lock_file): | ||
| return func() | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.