mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 20:18:38 +02:00
Doc update
This commit is contained in:
parent
7f8c0b9196
commit
aaa16842df
2 changed files with 22 additions and 11 deletions
|
@ -893,22 +893,28 @@ Example: `cf ssh getgov-za`
|
||||||
[Follow these steps](#use-scp-to-transfer-data-to-sandboxes) to upload the federal_cio csv to a sandbox of your choice.
|
[Follow these steps](#use-scp-to-transfer-data-to-sandboxes) to upload the federal_cio csv to a sandbox of your choice.
|
||||||
|
|
||||||
#### Step 5: Running the script
|
#### Step 5: Running the script
|
||||||
```./manage.py create_federal_portfolio "{federal_agency_name}" --both```
|
To create a specific portfolio:
|
||||||
|
```./manage.py create_federal_portfolio --agency_name "{federal_agency_name}" --both```
|
||||||
Example (only requests): `./manage.py create_federal_portfolio "AMTRAK" --parse_requests`
|
Example (only requests): `./manage.py create_federal_portfolio "AMTRAK" --parse_requests`
|
||||||
|
|
||||||
|
To create a portfolios for all federal agencies in a branch:
|
||||||
|
```./manage.py create_federal_portfolio --branch "{executive|legislative|judicial}" --both```
|
||||||
|
Example (only requests): `./manage.py create_federal_portfolio --branch "executive" --parse_requests`
|
||||||
|
|
||||||
### Running locally
|
### Running locally
|
||||||
|
|
||||||
#### Step 1: Running the script
|
#### Step 1: Running the script
|
||||||
```docker-compose exec app ./manage.py create_federal_portfolio "{federal_agency_name}" --both```
|
```docker-compose exec app ./manage.py create_federal_portfolio --agency_name "{federal_agency_name}" --both```
|
||||||
|
|
||||||
##### Parameters
|
##### Parameters
|
||||||
| | Parameter | Description |
|
| | Parameter | Description |
|
||||||
|:-:|:-------------------------- |:-------------------------------------------------------------------------------------------|
|
|:-:|:-------------------------- |:-------------------------------------------------------------------------------------------|
|
||||||
| 1 | **federal_agency_name** | Name of the FederalAgency record surrounded by quotes. For instance,"AMTRAK". |
|
| 1 | **agency_name** | Name of the FederalAgency record surrounded by quotes. For instance,"AMTRAK". |
|
||||||
| 2 | **both** | If True, runs parse_requests and parse_domains. |
|
| 2 | **branch** | Creates a portfolio for each federal agency in a branch: executive, legislative, judicial |
|
||||||
| 3 | **parse_requests** | If True, then the created portfolio is added to all related DomainRequests. |
|
| 3 | **both** | If True, runs parse_requests and parse_domains. |
|
||||||
| 4 | **parse_domains** | If True, then the created portfolio is added to all related Domains. |
|
| 4 | **parse_requests** | If True, then the created portfolio is added to all related DomainRequests. |
|
||||||
|
| 5 | **parse_domains** | If True, then the created portfolio is added to all related Domains. |
|
||||||
|
|
||||||
Note: Regarding parameters #2-#3, you cannot use `--both` while using these. You must specify either `--parse_requests` or `--parse_domains` seperately. While all of these parameters are optional in that you do not need to specify all of them,
|
- Parameters #1-#2: Either `--agency_name` or `--branch` must be specified. Not both.
|
||||||
|
- Parameters #2-#3, you cannot use `--both` while using these. You must specify either `--parse_requests` or `--parse_domains` seperately. While all of these parameters are optional in that you do not need to specify all of them,
|
||||||
you must specify at least one to run this script.
|
you must specify at least one to run this script.
|
||||||
|
|
|
@ -14,6 +14,7 @@ class Command(BaseCommand):
|
||||||
help = "Creates a federal portfolio given a FederalAgency name"
|
help = "Creates a federal portfolio given a FederalAgency name"
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
"""Defines fields to track what portfolios were updated, skipped, or just outright failed."""
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.updated_portfolios = set()
|
self.updated_portfolios = set()
|
||||||
self.skipped_portfolios = set()
|
self.skipped_portfolios = set()
|
||||||
|
@ -209,8 +210,11 @@ class Command(BaseCommand):
|
||||||
if not domain_requests.exists():
|
if not domain_requests.exists():
|
||||||
message = f"""
|
message = f"""
|
||||||
Portfolio '{portfolio}' not added to domain requests: no valid records found.
|
Portfolio '{portfolio}' not added to domain requests: no valid records found.
|
||||||
This means that a filter on DomainInformation for the federal_agency '{federal_agency}' and portfolio__isnull=True returned no results.
|
This means that a filter on DomainInformation for the federal_agency '{federal_agency}' returned no results.
|
||||||
Excluded statuses: STARTED, INELIGIBLE, REJECTED.
|
Excluded statuses: STARTED, INELIGIBLE, REJECTED.
|
||||||
|
Filter info: DomainRequest.objects.filter(federal_agency=federal_agency, portfolio__isnull=True).exclude(
|
||||||
|
status__in=invalid_states
|
||||||
|
)
|
||||||
"""
|
"""
|
||||||
TerminalHelper.colorful_logger(logger.info, TerminalColors.YELLOW, message)
|
TerminalHelper.colorful_logger(logger.info, TerminalColors.YELLOW, message)
|
||||||
return None
|
return None
|
||||||
|
@ -236,7 +240,8 @@ class Command(BaseCommand):
|
||||||
if not domain_infos.exists():
|
if not domain_infos.exists():
|
||||||
message = f"""
|
message = f"""
|
||||||
Portfolio '{portfolio}' not added to domains: no valid records found.
|
Portfolio '{portfolio}' not added to domains: no valid records found.
|
||||||
The filter on DomainInformation for the federal_agency '{federal_agency}' and portfolio__isnull=True returned no results.
|
The filter on DomainInformation for the federal_agency '{federal_agency}' returned no results.
|
||||||
|
Filter info: DomainInformation.objects.filter(federal_agency=federal_agency, portfolio__isnull=True)
|
||||||
"""
|
"""
|
||||||
TerminalHelper.colorful_logger(logger.info, TerminalColors.YELLOW, message)
|
TerminalHelper.colorful_logger(logger.info, TerminalColors.YELLOW, message)
|
||||||
return None
|
return None
|
||||||
|
@ -249,5 +254,5 @@ class Command(BaseCommand):
|
||||||
domain_info.sub_organization = suborgs.get(domain_info.organization_name)
|
domain_info.sub_organization = suborgs.get(domain_info.organization_name)
|
||||||
|
|
||||||
DomainInformation.objects.bulk_update(domain_infos, ["portfolio", "sub_organization"])
|
DomainInformation.objects.bulk_update(domain_infos, ["portfolio", "sub_organization"])
|
||||||
message = f"Added portfolio '{portfolio}' to {len(domain_infos)} domains"
|
message = f"Added portfolio '{portfolio}' to {len(domain_infos)} domains."
|
||||||
TerminalHelper.colorful_logger(logger.info, TerminalColors.OKGREEN, message)
|
TerminalHelper.colorful_logger(logger.info, TerminalColors.OKGREEN, message)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue