-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
45 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
master-v0.9 | ||
master-v0.9.1 |
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 |
---|---|---|
|
@@ -48,3 +48,39 @@ def set_photometry_status(fileid, status): | |
raise RuntimeError(res) | ||
|
||
return True | ||
|
||
#-------------------------------------------------------------------------------------------------- | ||
def cleanup_photometry_status(): | ||
""" | ||
Perform a cleanup of the photometry status indicator. | ||
This will change all processes still marked as "running" | ||
to "abort" if they have been running for more than a day. | ||
.. codeauthor:: Rasmus Handberg <[email protected]> | ||
""" | ||
# Validate the input: | ||
logger = logging.getLogger(__name__) | ||
|
||
# Get API token from config file: | ||
config = load_config() | ||
i_am_pipeline = config.getboolean('api', 'pipeline', fallback=False) | ||
if not i_am_pipeline: | ||
logger.debug("Not setting status since user is not pipeline") | ||
return False | ||
|
||
# Get API token from config file: | ||
token = config.get('api', 'token', fallback=None) | ||
if token is None: | ||
raise RuntimeError("No API token has been defined") | ||
|
||
# Send HTTP request to FLOWS server: | ||
r = requests.get('https://flows.phys.au.dk/api/cleanup_photometry_status.php', | ||
headers={'Authorization': 'Bearer ' + token}) | ||
r.raise_for_status() | ||
res = r.text.strip() | ||
|
||
if res != 'OK': | ||
raise RuntimeError(res) | ||
|
||
return True |
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