Skip to content
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

Add package-distributed-system - distributed actors implementation #977

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

freef4ll
Copy link

@freef4ll freef4ll commented Feb 12, 2025

Pull Request Description

Would like to add package-distributed-system; a package that uses distributed actors feature set.

Previous compiler crashes (swiftlang/swift#68517 and swiftlang/swift#79318) were identified - there should be value of validating new toolchain builds against this project.

Acceptance Criteria

To be accepted into the Swift source compatibility test suite, a project must:

  • be an Xcode or swift package manager project
  • support building on either Linux or macOS
  • target Linux, macOS, or iOS/tvOS/watchOS device
  • be contained in a publicly accessible git repository
  • maintain a project branch that builds against Swift 4.0 and passes any unit tests
  • have maintainers who will commit to resolve issues in a timely manner
  • be compatible with the latest GM/Beta versions of Xcode and swiftpm
  • add value not already included in the suite
  • be licensed with one of the following permissive licenses:
    • BSD
    • MIT
    • Apache License, version 2.0
    • Eclipse Public License
    • Mozilla Public License (MPL) 1.1
    • MPL 2.0
    • CDDL
  • pass ./project_precommit_check script run

@freef4ll
Copy link
Author

freef4ll commented Feb 12, 2025

I'm having issues with python in order, stock macOS 15.3 built in python3:

/usr/bin/python3 project_precommit_check package-distributed-system --earliest-compatible-swift-version 5.10
ModuleNotFoundError: No module named 'pipes'

if changing the pipes to shelx https://docs.python.org/3.12/library/subprocess.html#module-subprocess:

common.py", line 122, in <listcomp>
    return ' '.join([pipes.quote(x) for x in command])

Then this leads to:

  File "swift-source-compat-suite/project.py", line 804, in included_element
    any(evaluate_predicate(element, ip)
    ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        for ip in include_predicates)))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "swift-source-compat-suite/project.py", line 804, in <genexpr>
    any(evaluate_predicate(element, ip)
        ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "swift-source-compat-suite/project.py", line 796, in evaluate_predicate
    return eval(predicate)

With these changes I'm able to build:

diff --git a/common.py b/common.py
index c684e3c..09b4808 100755
--- a/common.py
+++ b/common.py
@@ -16,7 +16,6 @@
 import multiprocessing
 import os
 import pathlib
-import pipes
 import platform
 import signal
 import subprocess
@@ -119,7 +118,7 @@ def shell_join(command):
     >>> shell_join(['echo', 'Hello, World!'])
     "echo 'Hello, World!'"
     """
-    return ' '.join([pipes.quote(x) for x in command])
+    return ' '.join([shlex.quote(x) for x in command])


 def debug_print(s, stderr=sys.stderr):
diff --git a/project.py b/project.py
index d5f94ab..6506fe0 100644
--- a/project.py
+++ b/project.py
@@ -790,10 +790,11 @@ def add_minimal_arguments(parser):
 def evaluate_predicate(element, predicate):
     """Evaluate predicate in context of index element fields."""
     # pylint: disable=I0011,W0122,W0123
-    for key in element:
+    local_vars = {}
+    for key,value in element.items():
         if isinstance(element[key], str):
-            exec(key + ' = """' + element[key] + '"""')
-    return eval(predicate)
+            local_vars[key] = value
+    return eval(predicate, {}, local_vars)


 def included_element(include_predicates, exclude_predicates, element):

@freef4ll
Copy link
Author

On Linux(Ubuntu 24.04):

$ ./project_precommit_check --earliest-compatible-swift-version 5.10 hummingbird
** CHECK **
--- Validating hummingbird Swift version 5.10 compatibility ---
--- Project configured to be compatible with Swift 5.10 ---
--- Checking hummingbird platform compatibility with Linux ---
--- Platform compatibility check succeeded ---
Traceback (most recent call last):
  File /tmp/swift-source-compat-suite/./project_precommit_check", line 258, in <module>
    sys.exit(main())
             ^^^^^^
  File "/tmp/swift-source-compat-suite/./project_precommit_check", line 253, in main
    config = supported_configs[platform.system()][args.earliest_compatible_swift_version]
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '5.10'

@justice-adams-apple
Copy link
Contributor

@swift-ci test

@justice-adams-apple
Copy link
Contributor

@freef4ll Thanks for the PR! Yeah looks like that's from python 3.12, We will update those scripts once we update our CI machines to a new OS with a newer python.

As for the pre-commit check, that looks like its out of date on ubuntu, I'll open some PR's to update both the documentation and the pre-commit check 👍

@freef4ll
Copy link
Author

Thanks @justice-adams-apple!

I see the build failed according to the log:

error: failed downloading 'https://api.github.com/repos/ordo-one/mobile-dependencies-xcf/releases/assets/172962359-lz4-1.9.4.xcframework.zip' which is required by binary target 'lz4ios': downloadError("The request timed out.")

The environment proxy doesn't have access to api.github.com ?

@freef4ll
Copy link
Author

I fixed the lz4 failure. Lets try again, the build is in release mode currently and it might fail due to swiftlang/swift#79318, in which case will downgrade to a debug build for the time being.

@justice-adams-apple
Copy link
Contributor

@swift-ci test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants