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

Bug in NerscSFApi.py. #500

Open
StevenCTimm opened this issue May 15, 2024 · 1 comment
Open

Bug in NerscSFApi.py. #500

StevenCTimm opened this issue May 15, 2024 · 1 comment

Comments

@StevenCTimm
Copy link
Contributor

when testing on fermicloud814 we discovered a bug in NerscSFApi which hyunwoo helped me fix.
I tried to push it to decisionengine_modules repo but it seems I don't have the permissions.

This is the diff

[timm@snowball decisionengine_modules]$ git diff master
diff --git a/src/decisionengine_modules/NERSC/sources/NerscSFApi.py b/src/decisionengine_modules/NERSC/sources/NerscSFApi.py
index 5d38532..a084b3a 100644
--- a/src/decisionengine_modules/NERSC/sources/NerscSFApi.py
+++ b/src/decisionengine_modules/NERSC/sources/NerscSFApi.py
@@ -6,7 +6,7 @@ Get allocation info from Nersc SuperFacilityAPI
"""
import json

-# import time
+import time
import os

import jwt
@@ -36,7 +36,7 @@ class NerscSFApi(Source.Source):
self.logger = self.logger.bind(
class_module=name.split(".")[-1],
)

  •    self.localmap = {"uscms": "m2612", "fife": "m3249"}
    
  •    self.localmap = {"uscms": "m2612", "fife": "m4599", "dunepro": "m3249" }
       self.keys_list = ["hours_given", "hours_used", "id", "project_hours_given", "project_hours_used", "repo_name"]
    

    def check_accesstoken(self, nersc_user):
    @@ -62,14 +62,14 @@ class NerscSFApi(Source.Source):
    except KeyError:
    self.logger.error(f"Unknown user '{nersc_user}', exiting")
    return None

  •    print(nersc_user)
       rawfile = params_dict["rawfile"]
       pemfile = params_dict["private_key"]
       clientidfile = params_dict["client_id_file"]
       with open(clientidfile) as cifile:
           client_id = cifile.read()
           client_id = client_id.rstrip()
    
  •    atoken = None
       if not os.path.exists(rawfile):
           self.logger.debug(f"{rawfile} does not exist. Need to generate")
       else:
    

@@ -77,28 +77,36 @@ class NerscSFApi(Source.Source):
with open(rawfile) as afile:
atoken = afile.read()
atoken = atoken.rstrip()

@StevenCTimm StevenCTimm changed the title Bug in NerscSFApi.py. request assistance to make the PR Bug in NerscSFApi.py. May 15, 2024
@StevenCTimm
Copy link
Contributor Author

I have made PR #502 with the above patch.
Request review of it, please.

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

No branches or pull requests

1 participant