diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-12 02:46:05 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-12 02:46:05 +0000 |
| commit | e595c4f4c6cfac8e9fd48a03e423b274db9b3ede (patch) | |
| tree | c849b2d52b56e06ae7895fcce5c26e8c20f2e93d | |
| parent | a648fd2ff80e05cd299f2d3257b409e4310595ab (diff) | |
automatic import of python-proactive
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-proactive.spec | 555 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 557 insertions, 0 deletions
@@ -0,0 +1 @@ +/proactive-13.0.2.zip diff --git a/python-proactive.spec b/python-proactive.spec new file mode 100644 index 0000000..6ac9e52 --- /dev/null +++ b/python-proactive.spec @@ -0,0 +1,555 @@ +%global _empty_manifest_terminate_build 0 +Name: python-proactive +Version: 13.0.2 +Release: 1 +Summary: ProActive scheduler client module +License: Apache-2.0 +URL: https://github.com/ow2-proactive/proactive-python-client +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/bc/db/c0754b7edb41ae4c15a82fdc20a314ad8bac2845d3098f8af14f30829835/proactive-13.0.2.zip +BuildArch: noarch + + +%description + + + +[](https://proactive-python-client.readthedocs.io/en/latest/?badge=latest) + +# ProActive Python Client + +This module allows users to interact with a running ProActive Scheduler and Resource Manager. + +NOTE: To know how to use the Proactive Python Client in a more advanced way, please follow the link to see our [documentation](https://proactive-python-client.readthedocs.io/en/latest/). + +### 1. Requirements +* Python 2 and 3 + +### 2. Installation +`pip install proactive --upgrade` + +### 3. How to build +Just run `gradlew clean build` + +This will generate the `proactive-XXX.zip` file inside project's `dist` folder. + +Run `pip install dist/proactive-XXX.zip` to install the package in your python environment. + +### 4. Build and run tests +`./gradlew clean build -Pproactive_url=XXX -Pusername=XXX -Ppassword=XXX` + +Replace `XXX` with the respective information. + +### 5. Usage + +``` +import os +import getpass +import proactive + +print("Logging on proactive-server...") +proactive_host = 'try.activeeon.com' +proactive_port = '8080' +proactive_url = "http://"+proactive_host+":"+proactive_port +print("Connecting on: " + proactive_url) +javaopts=[] +# uncomment for detailed logs +# javaopts.append('-Dlog4j.configuration=file:'+os.path.join(os.getcwd(),'log4j.properties')) +gateway = proactive.ProActiveGateway(proactive_url, javaopts) + +gateway.connect(username="", password="") # put your login here! +# Or uncomment the following line to protect your password +# gateway.connect(username="", password=getpass.getpass(prompt='Password: ')) +assert gateway.isConnected() is True +print("Connected") + +try: + print("Creating a proactive task...") + proactive_task = gateway.createPythonTask() + proactive_task.setTaskName("SimplePythonTask") + proactive_task.setTaskImplementationFromFile('main.py', ['param1', 'param2']) + proactive_task.addInputFile('scripts/__init__.py') + proactive_task.addInputFile('scripts/hello.py') + + print("Adding a fork environment to the proactive task...") + proactive_fork_env = gateway.createDefaultForkEnvironment() + proactive_fork_env.setImplementationFromFile("scripts/fork_env.py") + proactive_task.setForkEnvironment(proactive_fork_env) + + print("Adding a selection script to the proactive task...") + proactive_selection_script = gateway.createDefaultSelectionScript() + proactive_selection_script.setImplementationFromFile("scripts/selection_script.py") + proactive_task.setSelectionScript(proactive_selection_script) + + print("Creating a proactive job...") + proactive_job = gateway.createJob() + proactive_job.setJobName("SimpleJob") + proactive_job.addTask(proactive_task) + proactive_job.setInputFolder(os.getcwd()) + proactive_job.setOutputFolder(os.getcwd()) + + print("Submitting the job to the proactive scheduler...") + job_id = gateway.submitJob(proactive_job, debug=False) + print("job_id: " + str(job_id)) + + print("Getting job output...") + job_result = gateway.getJobResult(job_id) + print(job_result) + +finally: + print("Disconnecting") + gateway.disconnect() + print("Disconnected") + gateway.terminate() + print("Finished") +``` + +### 6. Examples + +#### 6.1 Creating a Python task +``` +... +proactive_task = gateway.createPythonTask() +proactive_task.setTaskName("SimplePythonTask") +proactive_task.setTaskImplementation("""print("Hello world!")""") + +# or by +# proactive_task.setTaskImplementationFromFile("scripts/print_python_env.py") +# proactive_task.setTaskImplementationFromLambdaFunction(lambda: 88 - 20 * 10) + +# add attached files +# proactive_task.addInputFile('scripts/hello.py') + +# select your python version +# proactive_task.addGenericInformation("PYTHON_COMMAND", "/usr/bin/python3") +... +``` + +#### 6.2 Adding a fork environment +``` +... +fork_env = gateway.createDefaultForkEnvironment() +fork_env.setImplementationFromFile("scripts/fork_env.py") + +proactive_task.setForkEnvironment(fork_env) +... +``` + +#### 6.3 Adding a selection script +``` +... +selection_script = gateway.createDefaultSelectionScript() +selection_script.setImplementationFromFile("scripts/selection_script.py") + +proactive_task.setSelectionScript(selection_script) +... +``` + +#### 6.4 Create a job and add your task +``` +... +proactive_job = gateway.createJob() +proactive_job.setJobName("SimpleJob") +proactive_job.addTask(proactive_task) + +# for file transfer +# proactive_job.setInputFolder(os.getcwd()) +# proactive_job.setOutputFolder(os.getcwd()) +... +``` + +#### 6.5 Submit your job to the scheduler +``` +... +job_id = gateway.submitJob(proactive_job, debug=False) # set debug=True for more debug info +... +``` + +#### 6.6 Get the job results +``` +... +print("Getting job output...") +job_result = gateway.getJobResult(job_id) +print(job_result) +... +``` + +%package -n python3-proactive +Summary: ProActive scheduler client module +Provides: python-proactive +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-proactive + + + +[](https://proactive-python-client.readthedocs.io/en/latest/?badge=latest) + +# ProActive Python Client + +This module allows users to interact with a running ProActive Scheduler and Resource Manager. + +NOTE: To know how to use the Proactive Python Client in a more advanced way, please follow the link to see our [documentation](https://proactive-python-client.readthedocs.io/en/latest/). + +### 1. Requirements +* Python 2 and 3 + +### 2. Installation +`pip install proactive --upgrade` + +### 3. How to build +Just run `gradlew clean build` + +This will generate the `proactive-XXX.zip` file inside project's `dist` folder. + +Run `pip install dist/proactive-XXX.zip` to install the package in your python environment. + +### 4. Build and run tests +`./gradlew clean build -Pproactive_url=XXX -Pusername=XXX -Ppassword=XXX` + +Replace `XXX` with the respective information. + +### 5. Usage + +``` +import os +import getpass +import proactive + +print("Logging on proactive-server...") +proactive_host = 'try.activeeon.com' +proactive_port = '8080' +proactive_url = "http://"+proactive_host+":"+proactive_port +print("Connecting on: " + proactive_url) +javaopts=[] +# uncomment for detailed logs +# javaopts.append('-Dlog4j.configuration=file:'+os.path.join(os.getcwd(),'log4j.properties')) +gateway = proactive.ProActiveGateway(proactive_url, javaopts) + +gateway.connect(username="", password="") # put your login here! +# Or uncomment the following line to protect your password +# gateway.connect(username="", password=getpass.getpass(prompt='Password: ')) +assert gateway.isConnected() is True +print("Connected") + +try: + print("Creating a proactive task...") + proactive_task = gateway.createPythonTask() + proactive_task.setTaskName("SimplePythonTask") + proactive_task.setTaskImplementationFromFile('main.py', ['param1', 'param2']) + proactive_task.addInputFile('scripts/__init__.py') + proactive_task.addInputFile('scripts/hello.py') + + print("Adding a fork environment to the proactive task...") + proactive_fork_env = gateway.createDefaultForkEnvironment() + proactive_fork_env.setImplementationFromFile("scripts/fork_env.py") + proactive_task.setForkEnvironment(proactive_fork_env) + + print("Adding a selection script to the proactive task...") + proactive_selection_script = gateway.createDefaultSelectionScript() + proactive_selection_script.setImplementationFromFile("scripts/selection_script.py") + proactive_task.setSelectionScript(proactive_selection_script) + + print("Creating a proactive job...") + proactive_job = gateway.createJob() + proactive_job.setJobName("SimpleJob") + proactive_job.addTask(proactive_task) + proactive_job.setInputFolder(os.getcwd()) + proactive_job.setOutputFolder(os.getcwd()) + + print("Submitting the job to the proactive scheduler...") + job_id = gateway.submitJob(proactive_job, debug=False) + print("job_id: " + str(job_id)) + + print("Getting job output...") + job_result = gateway.getJobResult(job_id) + print(job_result) + +finally: + print("Disconnecting") + gateway.disconnect() + print("Disconnected") + gateway.terminate() + print("Finished") +``` + +### 6. Examples + +#### 6.1 Creating a Python task +``` +... +proactive_task = gateway.createPythonTask() +proactive_task.setTaskName("SimplePythonTask") +proactive_task.setTaskImplementation("""print("Hello world!")""") + +# or by +# proactive_task.setTaskImplementationFromFile("scripts/print_python_env.py") +# proactive_task.setTaskImplementationFromLambdaFunction(lambda: 88 - 20 * 10) + +# add attached files +# proactive_task.addInputFile('scripts/hello.py') + +# select your python version +# proactive_task.addGenericInformation("PYTHON_COMMAND", "/usr/bin/python3") +... +``` + +#### 6.2 Adding a fork environment +``` +... +fork_env = gateway.createDefaultForkEnvironment() +fork_env.setImplementationFromFile("scripts/fork_env.py") + +proactive_task.setForkEnvironment(fork_env) +... +``` + +#### 6.3 Adding a selection script +``` +... +selection_script = gateway.createDefaultSelectionScript() +selection_script.setImplementationFromFile("scripts/selection_script.py") + +proactive_task.setSelectionScript(selection_script) +... +``` + +#### 6.4 Create a job and add your task +``` +... +proactive_job = gateway.createJob() +proactive_job.setJobName("SimpleJob") +proactive_job.addTask(proactive_task) + +# for file transfer +# proactive_job.setInputFolder(os.getcwd()) +# proactive_job.setOutputFolder(os.getcwd()) +... +``` + +#### 6.5 Submit your job to the scheduler +``` +... +job_id = gateway.submitJob(proactive_job, debug=False) # set debug=True for more debug info +... +``` + +#### 6.6 Get the job results +``` +... +print("Getting job output...") +job_result = gateway.getJobResult(job_id) +print(job_result) +... +``` + +%package help +Summary: Development documents and examples for proactive +Provides: python3-proactive-doc +%description help + + + +[](https://proactive-python-client.readthedocs.io/en/latest/?badge=latest) + +# ProActive Python Client + +This module allows users to interact with a running ProActive Scheduler and Resource Manager. + +NOTE: To know how to use the Proactive Python Client in a more advanced way, please follow the link to see our [documentation](https://proactive-python-client.readthedocs.io/en/latest/). + +### 1. Requirements +* Python 2 and 3 + +### 2. Installation +`pip install proactive --upgrade` + +### 3. How to build +Just run `gradlew clean build` + +This will generate the `proactive-XXX.zip` file inside project's `dist` folder. + +Run `pip install dist/proactive-XXX.zip` to install the package in your python environment. + +### 4. Build and run tests +`./gradlew clean build -Pproactive_url=XXX -Pusername=XXX -Ppassword=XXX` + +Replace `XXX` with the respective information. + +### 5. Usage + +``` +import os +import getpass +import proactive + +print("Logging on proactive-server...") +proactive_host = 'try.activeeon.com' +proactive_port = '8080' +proactive_url = "http://"+proactive_host+":"+proactive_port +print("Connecting on: " + proactive_url) +javaopts=[] +# uncomment for detailed logs +# javaopts.append('-Dlog4j.configuration=file:'+os.path.join(os.getcwd(),'log4j.properties')) +gateway = proactive.ProActiveGateway(proactive_url, javaopts) + +gateway.connect(username="", password="") # put your login here! +# Or uncomment the following line to protect your password +# gateway.connect(username="", password=getpass.getpass(prompt='Password: ')) +assert gateway.isConnected() is True +print("Connected") + +try: + print("Creating a proactive task...") + proactive_task = gateway.createPythonTask() + proactive_task.setTaskName("SimplePythonTask") + proactive_task.setTaskImplementationFromFile('main.py', ['param1', 'param2']) + proactive_task.addInputFile('scripts/__init__.py') + proactive_task.addInputFile('scripts/hello.py') + + print("Adding a fork environment to the proactive task...") + proactive_fork_env = gateway.createDefaultForkEnvironment() + proactive_fork_env.setImplementationFromFile("scripts/fork_env.py") + proactive_task.setForkEnvironment(proactive_fork_env) + + print("Adding a selection script to the proactive task...") + proactive_selection_script = gateway.createDefaultSelectionScript() + proactive_selection_script.setImplementationFromFile("scripts/selection_script.py") + proactive_task.setSelectionScript(proactive_selection_script) + + print("Creating a proactive job...") + proactive_job = gateway.createJob() + proactive_job.setJobName("SimpleJob") + proactive_job.addTask(proactive_task) + proactive_job.setInputFolder(os.getcwd()) + proactive_job.setOutputFolder(os.getcwd()) + + print("Submitting the job to the proactive scheduler...") + job_id = gateway.submitJob(proactive_job, debug=False) + print("job_id: " + str(job_id)) + + print("Getting job output...") + job_result = gateway.getJobResult(job_id) + print(job_result) + +finally: + print("Disconnecting") + gateway.disconnect() + print("Disconnected") + gateway.terminate() + print("Finished") +``` + +### 6. Examples + +#### 6.1 Creating a Python task +``` +... +proactive_task = gateway.createPythonTask() +proactive_task.setTaskName("SimplePythonTask") +proactive_task.setTaskImplementation("""print("Hello world!")""") + +# or by +# proactive_task.setTaskImplementationFromFile("scripts/print_python_env.py") +# proactive_task.setTaskImplementationFromLambdaFunction(lambda: 88 - 20 * 10) + +# add attached files +# proactive_task.addInputFile('scripts/hello.py') + +# select your python version +# proactive_task.addGenericInformation("PYTHON_COMMAND", "/usr/bin/python3") +... +``` + +#### 6.2 Adding a fork environment +``` +... +fork_env = gateway.createDefaultForkEnvironment() +fork_env.setImplementationFromFile("scripts/fork_env.py") + +proactive_task.setForkEnvironment(fork_env) +... +``` + +#### 6.3 Adding a selection script +``` +... +selection_script = gateway.createDefaultSelectionScript() +selection_script.setImplementationFromFile("scripts/selection_script.py") + +proactive_task.setSelectionScript(selection_script) +... +``` + +#### 6.4 Create a job and add your task +``` +... +proactive_job = gateway.createJob() +proactive_job.setJobName("SimpleJob") +proactive_job.addTask(proactive_task) + +# for file transfer +# proactive_job.setInputFolder(os.getcwd()) +# proactive_job.setOutputFolder(os.getcwd()) +... +``` + +#### 6.5 Submit your job to the scheduler +``` +... +job_id = gateway.submitJob(proactive_job, debug=False) # set debug=True for more debug info +... +``` + +#### 6.6 Get the job results +``` +... +print("Getting job output...") +job_result = gateway.getJobResult(job_id) +print(job_result) +... +``` + +%prep +%autosetup -n proactive-13.0.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-proactive -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 13.0.2-1 +- Package Spec generated @@ -0,0 +1 @@ +44e22349d52c6c10ed7b43b93b12ce59 proactive-13.0.2.zip |
