Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pyParallelRunAndWrite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tetras-libre
pyParallelRunAndWrite
Commits
32919da7
Verified
Commit
32919da7
authored
Sep 12, 2018
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
Readme up
parent
c81ae144
No related branches found
No related tags found
No related merge requests found
Pipeline
#49
passed
Nov 19, 2018
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Readme.md
+55
-20
55 additions, 20 deletions
Readme.md
with
55 additions
and
20 deletions
Readme.md
+
55
−
20
View file @
32919da7
...
...
@@ -12,37 +12,72 @@ Do a parallel imap[_unordered](func, tasks) with numProc processes
+
if debug is set to true, errors are also printed to stderr
##
How to use
##
Install
###
As a subpackage
###
pip
```
python
from
pyParallelRunAndWrite
import
parallelRunAndWrite
as
prw
# The following dependencies are only useful for testFunc
import
os
from
time
import
sleep
from
random
import
randint
def
testFunc
(
arg
):
ret
=
str
(
arg
)
+
str
(
os
.
getpid
())
sleep
(
randint
(
2
,
5
))
if
(
randint
(
0
,
100
)
%
2
==
0
):
raise
Exception
(
"
COUCOU
"
+
ret
)
return
ret
prw
.
parallelRunAndWrite
(
testFunc
,
range
(
5
),
"
testplop
"
,
numProc
=
2
,
errFileName
=
"
errors
"
)
```
bash
pip3
install
git+https://gitlab.tetras-libre.fr/tetras-libre/pyParallelRunAndWrite@master#egg
=
pyParallelRunAndWrite
```
###
By installing i
t
###
For developpemen
t
```
bash
git clone https://gitlab.tetras-libre.fr/tetras-libre/pyParallelRunAndWrite
pip3
install
-e
.
```
Then :
### As a dependency in your setup.py
```
python
from
setuptools.command.install
import
install
from
setuptools.command.develop
import
develop
from
setuptools
import
setup
,
find_packages
import
pip
...
gitDeps
=
[
'
git+https://gitlab.tetras-libre.fr/tetras-libre/pyParallelRunAndWrite@master#egg=pyParallelRunAndWrite
'
,
]
def
customRun
(
command_subclass
):
orig_run
=
command_subclass
.
run
def
modified_run
(
self
):
for
dep
in
gitDeps
:
pip
.
main
([
'
install
'
,
dep
])
orig_run
(
self
)
command_subclass
.
run
=
modified_run
return
command_subclass
@customRun
class
actionsOnInstall
(
install
):
pass
@customRun
class
actionsOnDevelop
(
develop
):
pass
...
setup
(
...
cmdclass
=
{
'
install
'
:
actionsOnInstall
,
'
develop
'
:
actionsOnDevelop
,
...
)
```
## Usage
```
python
import
parallelRunAndWrite
as
prw
from
parallelRunAndWrite
import
parallelRunAndWrite
as
prw
# The following dependencies are only useful for testFunc
import
os
from
time
import
sleep
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment