Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Tutorial_parallelism
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ravi Tripathi
Tutorial_parallelism
Commits
c6e3d811
Commit
c6e3d811
authored
6 years ago
by
Ravi Tripathi
Browse files
Options
Downloads
Patches
Plain Diff
Giving choices in prep_env
parent
e258ae21
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
PART_1/prep_env
+25
-4
25 additions, 4 deletions
PART_1/prep_env
with
25 additions
and
4 deletions
PART_1/prep_env
+
25
−
4
View file @
c6e3d811
#!/usr/bin/python
import
os
import
argparse
import
random
,
string
def
create_testdir
():
current_directory
=
os
.
getcwd
()
...
...
@@ -9,13 +11,32 @@ def create_testdir():
os
.
makedirs
(
final_directory
)
return
final_directory
def
create_testfiles
(
dir
):
def
create_testfiles
_seq
(
dir
):
for
x
in
range
(
1
,
6
):
filename
=
'
test
'
+
str
(
x
)
+
'
.txt
'
filename
=
'
test
'
+
str
(
x
)
with
open
(
os
.
path
.
join
(
dir
,
filename
),
'
w
'
):
pass
def
create_testfiles_rand
(
dir
):
for
x
in
range
(
1
,
6
):
filename
=
''
.
join
(
random
.
sample
((
string
.
ascii_uppercase
+
string
.
digits
),
6
))
with
open
(
os
.
path
.
join
(
dir
,
filename
),
'
w
'
):
pass
def
create_testfiles_diff
(
dir
):
for
x
in
range
(
1
,
6
):
filename
=
'
test
'
+
str
(
x
)
+
'
.txt
'
with
open
(
os
.
path
.
join
(
dir
,
filename
),
'
w
'
):
pass
if
__name__
==
"
__main__
"
:
#global final_directory
parser
=
argparse
.
ArgumentParser
(
description
=
'
Create a test environment to run parallelism.
'
)
parser
.
add_argument
(
'
type
'
,
choices
=
[
'
seq
'
,
'
rand
'
,
'
diff
'
],
help
=
'
Type of test directory to create
'
)
args
=
parser
.
parse_args
()
testdir
=
create_testdir
()
create_testfiles
(
testdir
)
if
args
.
type
==
'
seq
'
:
create_testfiles_seq
(
testdir
)
if
args
.
type
==
'
rand
'
:
create_testfiles_rand
(
testdir
)
if
args
.
type
==
'
seq
'
:
create_testfiles_diff
(
testdir
)
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