Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
self-reg-form
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Krish Moodbidri
self-reg-form
Commits
3e61295a
Commit
3e61295a
authored
4 years ago
by
Krish Moodbidri
Browse files
Options
Downloads
Patches
Plain Diff
Delete rc_util.py
parent
79c24e0e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#4241
failed with stage
Stage: lint
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rc_util.py
+0
-72
0 additions, 72 deletions
rc_util.py
with
0 additions
and
72 deletions
rc_util.py
deleted
100644 → 0
+
0
−
72
View file @
79c24e0e
import
logging
import
argparse
from
rc_rmq
import
RCRMQ
import
json
rc_rmq
=
RCRMQ
({
'
exchange
'
:
'
RegUsr
'
,
'
exchange_type
'
:
'
topic
'
})
tasks
=
{
'
ohpc_account
'
:
None
,
'
ood_account
'
:
None
,
'
slurm_account
'
:
None
}
logger_fmt
=
'
%(asctime)s [%(module)s] - %(message)s
'
def
add_account
(
username
,
email
,
full
=
''
,
reason
=
''
):
rc_rmq
.
publish_msg
({
'
routing_key
'
:
'
request.
'
+
username
,
'
msg
'
:
{
"
username
"
:
username
,
"
email
"
:
email
,
"
fullname
"
:
full
,
"
reason
"
:
reason
}
})
rc_rmq
.
disconnect
()
def
worker
(
ch
,
method
,
properties
,
body
):
msg
=
json
.
loads
(
body
)
task
=
msg
[
'
task
'
]
tasks
[
task
]
=
msg
[
'
success
'
]
print
(
"
Got msg: {}({})
"
.
format
(
msg
[
'
task
'
],
msg
[
'
success
'
]))
# Check if all tasks are done
done
=
True
for
key
,
status
in
tasks
.
items
():
if
not
status
:
print
(
"
{} is not done yet.
"
.
format
(
key
))
done
=
False
if
done
:
rc_rmq
.
stop_consume
()
rc_rmq
.
delete_queue
()
def
consume
(
username
,
callback
=
worker
,
debug
=
False
):
if
debug
:
sleep
(
5
)
else
:
rc_rmq
.
start_consume
({
'
queue
'
:
username
,
'
routing_key
'
:
'
confirm.
'
+
username
,
'
cb
'
:
callback
})
rc_rmq
.
disconnect
()
return
{
'
success
'
:
True
}
def
get_args
():
# Parse arguments
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
-v
'
,
'
--verbose
'
,
action
=
'
store_true
'
,
help
=
'
verbose output
'
)
parser
.
add_argument
(
'
-n
'
,
'
--dry-run
'
,
action
=
'
store_true
'
,
help
=
'
enable dry run mode
'
)
return
parser
.
parse_args
()
def
get_logger
(
args
=
None
):
if
args
is
None
:
args
=
get_args
()
logger_lvl
=
logging
.
WARNING
if
args
.
verbose
:
logger_lvl
=
logging
.
DEBUG
if
args
.
dry_run
:
logger_lvl
=
logging
.
INFO
logging
.
basicConfig
(
format
=
logger_fmt
,
level
=
logger_lvl
)
return
logging
.
getLogger
(
__name__
)
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