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

Build test Darwin version of min OpenSearch distribution to support plugin testing on MacOS. #2216

Closed
7 tasks done
prudhvigodithi opened this issue Jun 20, 2022 · 13 comments
Closed
7 tasks done
Assignees
Labels
enhancement New Enhancement Meta

Comments

@prudhvigodithi
Copy link
Collaborator

prudhvigodithi commented Jun 20, 2022

Is your feature request related to a problem? Please describe

For k-NN, to run integ tests on Mac is not compatible.
KNN uses lang painless to inject scripts. To test on MacOS right now the options are INTEG_TEST, which will bring up a cluster with plain and no modules (mainly lang painless) except transportModulesFiles
Second option is to use ARCHIVE which will allow direct download of zip and test bringing up the cluster, which looks for darwin zip, which is not available for testing.

opensearch-project/OpenSearch#1676

Describe the solution you'd like

Describe alternatives you've considered

Other alternatives is to test on Linux, Docker but this requires developers with MacOs to setup alternative virtual machines to test the plugins.

Additional context

#38 (comment)

Acceptance Criteria

  • Test using the existing assemble task from OpenSearch distribution:archives:darwin-arm64-tar:assemble to build the darwin min distribution, integrate with build workflow to automate the min distribution creation.
  • Test with cross compile framework to build darwin min distribution with existing build workflow.
  • Approach to be considered: directly run the build workflow on mac ec2 instance that has supported architecture MACHTYPE=x86_64
@prudhvigodithi prudhvigodithi added enhancement New Enhancement untriaged Issues that have not yet been triaged labels Jun 20, 2022
@prudhvigodithi prudhvigodithi changed the title Build test Darwin min OpenSearch distribution to support plugin testing on MacOS. Build test Darwin version of min OpenSearch distribution to support plugin testing on MacOS. Jun 20, 2022
@bbarani bbarani removed the untriaged Issues that have not yet been triaged label Jun 22, 2022
@jmazanec15
Copy link
Member

Hi @prudhvigodithi and @bbarani, how much effort will this take to do/what release will this be targeted for? Do we already have support for MacOS ec2 agent's? Are there any tasks on this I could pick up?

@prudhvigodithi
Copy link
Collaborator Author

prudhvigodithi commented Jul 26, 2022

Hey we have development version of Darwin min artifact out for testing. This is not a production ready distribution but can be used for development. You can use the below URL (as a reference) to download the Darwin min artifact corresponding to specific OpenSearch version ( >2.1 version )

2.1.1 Mac -min artifact can be downloaded from
https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.1.1/latest/darwin/x64/tar/builds/opensearch/dist/opensearch-min-2.1.1-darwin-x64.tar.gz
2.2.0 Mac -min artifact can be downloaded from

https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.2.0/latest/darwin/x64/tar/builds/opensearch/dist/opensearch-min-2.2.0-darwin-x64.tar.gz

Please test and provide your feedback. Thanks!
Thank you
@bbarani @jmazanec15

@jmazanec15
Copy link
Member

jmazanec15 commented Jul 26, 2022

Thanks @prudhvigodithi!

When running:

./gradlew build 
...
> Task :integTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':integTest'.
> Could not resolve all files for configuration ':opensearch_distro_extracted_testclusters--integTest-0-2.1.1-SNAPSHOT-'.
   > Could not resolve opensearch-distribution-snapshot:opensearch:2.1.1-SNAPSHOT.
     Required by:
         project :
      > Could not resolve opensearch-distribution-snapshot:opensearch:2.1.1-SNAPSHOT.
         > Could not get resource 'https://artifacts.opensearch.org/snapshots/core/opensearch/2.1.1-SNAPSHOT/opensearch-min-2.1.1-SNAPSHOT-darwin-x64-latest.tar.gz'.
            > Could not HEAD 'https://artifacts.opensearch.org/snapshots/core/opensearch/2.1.1-SNAPSHOT/opensearch-min-2.1.1-SNAPSHOT-darwin-x64-latest.tar.gz'. Received status code 403 from server: Forbidden

However, when downloading custom url and using it, it appears to work (will confirm in about 20 min - accidentally posted comment too soon):

./gradlew build -PcustomDistributionUrl=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.1.1/latest/darwin/x64/tar/builds/opensearch/dist/opensearch-min-2.1.1-darwin-x64.tar.gz
...

@jmazanec15
Copy link
Member

However, when downloading custom url and using it, it appears to work (will confirm in about 20 min - accidentally posted comment too soon):
./gradlew build -PcustomDistributionUrl=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.1.1/latest/darwin/x64/tar/builds/opensearch/dist/opensearch-min-2.1.1-darwin-x64.tar.gz
...

Confirmed build was successful!

Is it possible to publish artifact to "https://artifacts.opensearch.org" instead of "https://ci.opensearch.org" so that we dont have to pass -PcustomDistributionUrl flag for building? For opensearchplugin, ARCHIVE defaults to "https://artifacts.opensearch.org"

@prudhvigodithi
Copy link
Collaborator Author

prudhvigodithi commented Jul 28, 2022

Is it possible to publish artifact to "https://artifacts.opensearch.org" instead of "https://ci.opensearch.org" so that we dont have to pass -PcustomDistributionUrl flag for building? For opensearchplugin, ARCHIVE defaults to "https://artifacts.opensearch.org"

Hey We now have the darwin min snapshot artifacts accessible via https://artifacts.opensearch.org/, the default URL used in OpenSearch.

Jenkins build Mac 2.2.0-SNAPSHOT https://artifacts.opensearch.org/snapshots/core/opensearch/2.2.0-SNAPSHOT/opensearch-min-2.2.0-SNAPSHOT-darwin-x64-latest.tar.gz

Jenkins build Mac 2.1.1-SNAPSHOT https://artifacts.opensearch.org/snapshots/core/opensearch/2.1.1-SNAPSHOT/opensearch-min-2.1.1-SNAPSHOT-darwin-x64-latest.tar.gz

@jmazanec15 when you get a chance can you please test and update?
Thank you
@bbarani

@saratvemulapalli
Copy link
Member

saratvemulapalli commented Jul 28, 2022

Thanks @prudhvigodithi, this is amazing . I happen to work with AD plugin and it works!!

./gradlew build                                                                                                                                                                                 
=======================================
OpenSearch Build Hamster says Hello!
  Gradle Version        : 7.4.2
  OS Info               : Mac OS X 10.16 (x86_64)
  JDK Version           : 14 (Oracle JDK)
  JAVA_HOME             : /Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home
  Random Testing Seed   : 3D7474600A5D2F17
  In FIPS 140 mode      : false
=======================================

> Task :compileJava
Note: /Users/vemsarat/Desktop/workspace/Code/anomaly-detection/src/main/java/org/opensearch/ad/ml/EntityColdStarter.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/vemsarat/Desktop/workspace/Code/anomaly-detection/src/main/java/org/opensearch/ad/task/ADBatchTaskRunner.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
<==========---> 79% EXECUTING [30s]
> :integTest > Resolve files of :opensearch_distro_extracted_testclusters--integTest-0-2.1.1-SNAPSHOT- > opensearch-min-2.1.1-SNAPSHOT-darwin-x64-latest.tar.gz > 141.9 MiB/209.5 MiB downloaded

@prudhvigodithi
Copy link
Collaborator Author

Thanks @prudhvigodithi, this is amazing . I happen to work with AD plugin and it works!!

Thanks for testing @saratvemulapalli ;)

@prudhvigodithi
Copy link
Collaborator Author

Closing this issue as the tasks part of this META issue are marked complete, please feel free to re-open if required.
Thank you

@Arpit-Bandejiya
Copy link
Contributor

Hi @prudhvigodithi while trying to build async-search for 3.0.0 in mac I'm facing the below error:

abandeji@bcd074462b7f asynchronous-search % ./gradlew build -PcustomDistributionUrl=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/3.0.0/latest/darwin/x64/tar/builds/opensearch/dist/opensearch-min-3.0.0-darwin-x64.tar.gz
=======================================
OpenSearch Build Hamster says Hello!
  Gradle Version        : 7.4.2
  OS Info               : Mac OS X 13.2.1 (aarch64)
  JDK Version           : 17 (Amazon Corretto JDK)
  JAVA_HOME             : /Users/abandeji/.sdkman/candidates/java/17.0.6-amzn
  Random Testing Seed   : 9DCE0F0910A72E66
  In FIPS 140 mode      : false
=======================================
> Task :integTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':integTest'.
> Could not resolve all files for configuration ':opensearch_distro_extracted_testclusters--integTest-0-3.0.0-SNAPSHOT-'.
   > Could not resolve opensearch-distribution-snapshot:opensearch:3.0.0-SNAPSHOT.
     Required by:
         project :
      > Could not resolve opensearch-distribution-snapshot:opensearch:3.0.0-SNAPSHOT.
         > Could not get resource 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/3.0.0/latest/darwin/x64/tar/builds/opensearch/dist/opensearch-min-3.0.0-darwin-x64.tar.gz'.
            > Could not HEAD 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/3.0.0/7106/darwin/x64/tar/builds/opensearch/dist/opensearch-min-3.0.0-darwin-x64.tar.gz'. Received status code 403 from server: Forbidden

Is there a way to check the url is correct or not? I'm not able to visit the base ci.opensearch.org as well since it says forbidden on browser.

@prudhvigodithi
Copy link
Collaborator Author

Hey @Arpit-Bandejiya the URL is as follows
https://artifacts.opensearch.org/snapshots/core/opensearch/3.0.0-SNAPSHOT/opensearch-min-3.0.0-SNAPSHOT-darwin-x64-latest.tar.gz
Also if you are by default using a mac workspace the default pulled should be a darwin min. All the snapshots are stored in artifacts.opensearch.org, so if you still want to use -PcustomDistributionUrl then the command is as follows

./gradlew build -PcustomDistributionUrl=https://artifacts.opensearch.org/snapshots/core/opensearch/3.0.0-SNAPSHOT/opensearch-min-3.0.0-SNAPSHOT-darwin-x64-latest.tar.gz

Please try with this and let me know.
Thank you

@Arpit-Bandejiya
Copy link
Contributor

This works @prudhvigodithi thanks!

@Arpit-Bandejiya
Copy link
Contributor

@prudhvigodithi I have one question though when I build it without passing this flag, I get this error:

* What went wrong:
Execution failed for task ':integTest'.
> Could not resolve all files for configuration ':opensearch_distro_extracted_testclusters--integTest-0-3.0.0-SNAPSHOT-'.
   > Could not resolve opensearch-distribution-snapshot:opensearch:3.0.0-SNAPSHOT.
     Required by:
         project :
      > Could not resolve opensearch-distribution-snapshot:opensearch:3.0.0-SNAPSHOT.
         > Could not get resource 'https://artifacts.opensearch.org/snapshots/core/opensearch/3.0.0-SNAPSHOT/opensearch-min-3.0.0-SNAPSHOT-darwin-arm64-latest.tar.gz'.
            > Could not HEAD 'https://artifacts.opensearch.org/snapshots/core/opensearch/3.0.0-SNAPSHOT/opensearch-min-3.0.0-SNAPSHOT-darwin-arm64-latest.tar.gz'. Received status code 403 from server: Forbidden

As can be seen the url is same as one we passed in command line. Any possible reason of this failing?

@prudhvigodithi
Copy link
Collaborator Author

Hey @Arpit-Bandejiya We are publishing darwin x64, the URL is not same if you notice it is going to arm64 (from your screenshot opensearch-min-3.0.0-SNAPSHOT-darwin-arm64-latest.tar.gz)

Sample Download URL:
https://artifacts.opensearch.org/snapshots/core/opensearch/3.0.0-SNAPSHOT/opensearch-min-3.0.0-SNAPSHOT-darwin-x64-latest.tar.gz

Mac os support x86_64 and arm64 as well, mac m1 works for both x86_64 and arm64 with help of Rosetta 2
arm64 is the architecture used by newer Macs built on Apple Silicon, shipped in late 2020 and beyond, but x64 should work as well, pgrep oahd should output the Rosetta process

Useful blog's:
https://eclecticlight.co/2021/01/22/running-intel-code-on-your-m1-mac-rosetta-2-and-oah/
https://docs.elementscompiler.com/Platforms/Cocoa/CpuArchitectures/#:~:text=On%20macOS%2C%20two%20architecture%20are,in%20late%202020%20and%20beyond.

So in your case please use -PcustomDistributionUrl.

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

No branches or pull requests

5 participants