-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from omnivector-solutions/tucker/JOB-86--add-a…
…uth0-token-support-to-jobbergate-cli Tucker/job 86 add auth0 token support to jobbergate cli
- Loading branch information
Showing
15 changed files
with
708 additions
and
507 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
""" | ||
Configuration file, sets all the necessary environment variables. | ||
Can load configuration from a dotenv file if supplied. | ||
""" | ||
from pathlib import Path | ||
from typing import Optional | ||
|
||
from pydantic import AnyHttpUrl, BaseSettings, Field, root_validator | ||
import urllib3 | ||
|
||
from jobbergate_cli import constants | ||
|
||
|
||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | ||
|
||
|
||
class Settings(BaseSettings): | ||
|
||
JOBBERGATE_CACHE_DIR: Path = Field(Path.home() / ".local/share/jobbergate") | ||
JOBBERGATE_API_ENDPOINT: AnyHttpUrl = Field("https://jobbergateapi2-staging.omnivector.solutions") | ||
|
||
# enable http tracing | ||
JOBBERGATE_DEBUG: bool = Field(False) | ||
|
||
SBATCH_PATH: Path = Field("/usr/bin/sbatch") | ||
SENTRY_DSN: Optional[str] | ||
|
||
# Settings for log uploads | ||
JOBBERGATE_AWS_ACCESS_KEY_ID: Optional[str] | ||
JOBBERGATE_AWS_SECRET_ACCESS_KEY: Optional[str] | ||
JOBBERGATE_S3_LOG_BUCKET: str = Field("jobbergate-cli-logs") | ||
|
||
# Computed values. Listed as Optional, but will *always* be set (or overridden) based on other values | ||
JOBBERGATE_APPLICATION_MODULE_PATH: Optional[Path] | ||
JOBBERGATE_APPLICATION_CONFIG_PATH: Optional[Path] | ||
JOBBERGATE_LOG_PATH: Optional[Path] | ||
JOBBERGATE_USER_TOKEN_DIR: Optional[Path] | ||
JOBBERGATE_API_JWT_PATH: Optional[Path] | ||
|
||
@root_validator | ||
def compute_extra_settings(cls, values): | ||
cache_dir = values["JOBBERGATE_CACHE_DIR"] | ||
cache_dir.mkdir(exist_ok=True, parents=True) | ||
|
||
values["JOBBERGATE_APPLICATION_MODULE_PATH"] = ( | ||
cache_dir / constants.JOBBERGATE_APPLICATION_MODULE_FILE_NAME | ||
) | ||
values["JOBBERGATE_APPLICATION_CONFIG_PATH"] = ( | ||
cache_dir / constants.JOBBERGATE_APPLICATION_CONFIG_FILE_NAME | ||
) | ||
|
||
log_dir = cache_dir / "logs" | ||
log_dir.mkdir(exist_ok=True, parents=True) | ||
values["JOBBERGATE_LOG_PATH"] = log_dir / "jobbergate-cli.log" | ||
|
||
token_dir = cache_dir / "token" | ||
token_dir.mkdir(exist_ok=True, parents=True) | ||
values["JOBBERGATE_USER_TOKEN_DIR"] = token_dir | ||
values["JOBBERGATE_API_JWT_PATH"] = token_dir / "jobbergate.token" | ||
|
||
return values | ||
|
||
class Config: | ||
if constants.JOBBERGATE_DEFAULT_DOTENV_PATH.is_file(): | ||
env_file = constants.JOBBERGATE_DEFAULT_DOTENV_PATH | ||
else: | ||
env_file = ".env" | ||
|
||
|
||
settings = Settings() |
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
""" | ||
Constants used throughout the tool | ||
""" | ||
from pathlib import Path | ||
|
||
|
||
JOBBERGATE_APPLICATION_CONFIG = { | ||
"application_name": "", | ||
"application_description": "", | ||
"application_file": "", | ||
"application_config": "", | ||
} | ||
|
||
JOBBERGATE_JOB_SCRIPT_CONFIG = { | ||
"job_script_name": "", | ||
"job_script_description": "TEST_DESC", | ||
"job_script_owner": "", | ||
"application": "", | ||
} | ||
|
||
JOBBERGATE_JOB_SUBMISSION_CONFIG = { | ||
"job_submission_name": "", | ||
"job_submission_description": "TEST_DESC", | ||
"job_submission_owner": "", | ||
"job_script": "", | ||
} | ||
|
||
JOBBERGATE_DEFAULT_DOTENV_PATH = Path("/etc/default/jobbergate-cli") | ||
JOBBERGATE_APPLICATION_MODULE_FILE_NAME = "jobbergate.py" | ||
JOBBERGATE_APPLICATION_CONFIG_FILE_NAME = "jobbergate.yaml" | ||
TAR_NAME = "jobbergate.tar.gz" | ||
|
||
ARMADA_CLAIMS_KEY = "https://www.armada-hpc.com" | ||
|
||
DEFAULT_MAX_BYTES_DEBUG = 1000 |
Oops, something went wrong.