-
Notifications
You must be signed in to change notification settings - Fork 370
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
add option CHARGE_ACCOUNT to charge compute time if different from PROJECT #1718
Conversation
… PROJECT This option can be set by environment variable or in config_machines.xml Helpful because PROJECT can be used for directory names that don't match the name of the charge account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline
cime/scripts/create_newcase
Outdated
@@ -59,6 +59,7 @@ OR | |||
parser.add_argument("--project", "-project", | |||
help="Specify a project id") | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plz remove unnecessary newline.
cime/scripts/create_test
Outdated
@@ -183,6 +183,7 @@ OR | |||
"Used for accounting when on a batch system." | |||
"The default is user-specified environment variable PROJECT") | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
1. Environment variable CHARGE_ACCOUNT | ||
2. File $HOME/.cime/config | ||
3. config_machines.xml (if machobj provided) | ||
4. default to same value as PROJECT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intricate enough to warrant a unit test. A couple simple doctests would suffice.
whitespace fixed.
I'd be happy to make a unit test for it, but haven't done these before. Is
there a similar existing test I can base it off of?
…On Tue, Aug 15, 2017 at 1:25 PM, James Foucar ***@***.***> wrote:
***@***.**** requested changes on this pull request.
See inline
------------------------------
In cime/scripts/create_newcase
<#1718 (comment)>:
> @@ -59,6 +59,7 @@ OR
parser.add_argument("--project", "-project",
help="Specify a project id")
+
Plz remove unnecessary newline.
------------------------------
In cime/scripts/create_test
<#1718 (comment)>:
> @@ -183,6 +183,7 @@ OR
"Used for accounting when on a batch system."
"The default is user-specified environment variable PROJECT")
+
Ditto
------------------------------
In cime/scripts/lib/CIME/utils.py
<#1718 (comment)>:
> @@ -618,6 +618,36 @@ def get_project(machobj=None):
logger.info("No project info available")
return None
+def get_charge_account(machobj=None):
+ """
+ Hierarchy for choosing CHARGE_ACCOUNT:
+ 1. Environment variable CHARGE_ACCOUNT
+ 2. File $HOME/.cime/config
+ 3. config_machines.xml (if machobj provided)
+ 4. default to same value as PROJECT
This is intricate enough to warrant a unit test. A couple simple doctests
would suffice.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1718 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEs_usoS2w0X5BB4f505o5ncFyIMCNnAks5sYeKZgaJpZM4O32U6>
.
|
Since the function uses a Machine object, the unit test would probably look most like some of the tests in machines.py. Look for <<< |
I've added a couple of tests, let me know if you have any more suggestions |
4. default to same value as PROJECT | ||
|
||
>>> import CIME | ||
>>> import CIME.XML.machines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks perfect, thanks.
cime/scripts/lib/CIME/utils.py
Outdated
>>> os.environ["CHARGE_ACCOUNT"] = "ChargeAccount" | ||
>>> get_charge_account(machobj) | ||
'ChargeAccount' | ||
>>> reset_cime_config() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, one quick note: I think you should unset CHARGE_ACCOUNT here instead of resetting cime_config. We don't want this env variable to pollute other tests.
Approved. Waiting for @mrnorman |
Sorry, I've been out sick for a couple of weeks. Also Titan's down today. So hopefully I can test this tomorrow. |
When does CHARGE_ACCOUNT need to be defined in the environment? At ./create_newcase, ./case.setup, or ./case.submit? It would be convenient if it only has to be specified at ./case.submit if that's possible. I'm currently testing it with it defined at ./create_newcase level to make sure it works for me on Titan. |
the CHARGE_ACCOUNT environment variable is only checked when running
./create_newcase (or ./create_test), when it builds the env_batch.xml file
…On Thu, Aug 24, 2017 at 11:47 AM, Matt Norman ***@***.***> wrote:
When does CHARGE_ACCOUNT need to be defined in the environment? At
./create_newcase, ./case.setup, or ./case.submit? It would be convenient if
it only has to be specified at ./case.submit if that's possible. I'm
currently testing it with it defined at ./create_newcase level to make sure
it works for me on Titan.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1718 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEs_ugs_XTM6Pm-7nldNerMHkP5PubFDks5sbak8gaJpZM4O32U6>
.
|
Well, it ran successfully for me on Titan. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works on Titan for csc190acme.
OK, merging |
You can also use xmlchange to set this value
…On Thu, Aug 24, 2017 at 12:10 PM, Jason Sarich ***@***.***> wrote:
the CHARGE_ACCOUNT environment variable is only checked when running
./create_newcase (or ./create_test), when it builds the env_batch.xml file
On Thu, Aug 24, 2017 at 11:47 AM, Matt Norman ***@***.***>
wrote:
> When does CHARGE_ACCOUNT need to be defined in the environment? At
> ./create_newcase, ./case.setup, or ./case.submit? It would be convenient if
> it only has to be specified at ./case.submit if that's possible. I'm
> currently testing it with it defined at ./create_newcase level to make sure
> it works for me on Titan.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#1718 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AEs_ugs_XTM6Pm-7nldNerMHkP5PubFDks5sbak8gaJpZM4O32U6>
> .
>
|
) add option CHARGE_ACCOUNT to charge compute time if different from PROJECT This option can be set by environment variable, in config_machines.xml, or with xmlchange. Helpful because PROJECT can be used for directory names that don't match the name of the charge account. Addresses issue #1588 * origin/sarich/scripts/feature-charge-account: unset CHARGE_ACCOUNT environment variable in tests Add simple doctests to get_charge_account whitespace edits add option CHARGE_ACCOUNT to charge compute time to if different from PROJECT
Merged to next, I'll merge to master if it doesn't break anything. |
@mrnorman , what experiment did you run? Do you know where the performance data was put? In $PROJECT or $CHARGE_ACCOUNT project directory? ($PROJECT would be my preference.) |
It should go to $PROJECT directory, $CHARGE_ACCOUNT is only used to set the
account flag in the queue submission.
…On Thu, Aug 24, 2017 at 12:17 PM, worleyph ***@***.***> wrote:
@mrnorman <https://github.com/mrnorman> , what experiment did you run? Do
you know where the performance data was put? In $PROJECT or $CHARGE_ACCOUNT
project directory? ($PROJECT would be my preference.)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1718 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEs_ukAXvc8AIaBcBBGD9fEwbthr7T1xks5sbbAqgaJpZM4O32U6>
.
|
@worleyph I ran FC5AV1C-L with csc190acme, specifying CHARGE_ACCOUNT=csc190acme in the environment and -project csc190 in the create_newcase. It successfully ran. |
/lustre/atlas/proj-shared/csc190/performance_archive/imn/test_charge_project is where the performance data went. |
Thanks. Looks good. |
When will this be merged to master? |
…1718) add option CHARGE_ACCOUNT to charge compute time if different from PROJECT This option can be set by environment variable, in config_machines.xml, or with xmlchange. Helpful because PROJECT can be used for directory names that don't match the name of the charge account. Addresses issue #1588 * origin/sarich/scripts/feature-charge-account: unset CHARGE_ACCOUNT environment variable in tests Add simple doctests to get_charge_account whitespace edits add option CHARGE_ACCOUNT to charge compute time to if different from PROJECT
@mrnorman done. |
Sweet! |
…1718) add option CHARGE_ACCOUNT to charge compute time if different from PROJECT This option can be set by environment variable, in config_machines.xml, or with xmlchange. Helpful because PROJECT can be used for directory names that don't match the name of the charge account. Addresses issue #1588 * origin/sarich/scripts/feature-charge-account: unset CHARGE_ACCOUNT environment variable in tests Add simple doctests to get_charge_account whitespace edits add option CHARGE_ACCOUNT to charge compute time to if different from PROJECT
…1718) add option CHARGE_ACCOUNT to charge compute time if different from PROJECT This option can be set by environment variable, in config_machines.xml, or with xmlchange. Helpful because PROJECT can be used for directory names that don't match the name of the charge account. Addresses issue #1588 * origin/sarich/scripts/feature-charge-account: unset CHARGE_ACCOUNT environment variable in tests Add simple doctests to get_charge_account whitespace edits add option CHARGE_ACCOUNT to charge compute time to if different from PROJECT
…1718) add option CHARGE_ACCOUNT to charge compute time if different from PROJECT This option can be set by environment variable, in config_machines.xml, or with xmlchange. Helpful because PROJECT can be used for directory names that don't match the name of the charge account. Addresses issue #1588 * origin/sarich/scripts/feature-charge-account: unset CHARGE_ACCOUNT environment variable in tests Add simple doctests to get_charge_account whitespace edits add option CHARGE_ACCOUNT to charge compute time to if different from PROJECT
…1718) add option CHARGE_ACCOUNT to charge compute time if different from PROJECT This option can be set by environment variable, in config_machines.xml, or with xmlchange. Helpful because PROJECT can be used for directory names that don't match the name of the charge account. Addresses issue #1588 * origin/sarich/scripts/feature-charge-account: unset CHARGE_ACCOUNT environment variable in tests Add simple doctests to get_charge_account whitespace edits add option CHARGE_ACCOUNT to charge compute time to if different from PROJECT
…1718) add option CHARGE_ACCOUNT to charge compute time if different from PROJECT This option can be set by environment variable, in config_machines.xml, or with xmlchange. Helpful because PROJECT can be used for directory names that don't match the name of the charge account. Addresses issue #1588 * origin/sarich/scripts/feature-charge-account: unset CHARGE_ACCOUNT environment variable in tests Add simple doctests to get_charge_account whitespace edits add option CHARGE_ACCOUNT to charge compute time to if different from PROJECT
This option can be set by environment variable, in config_machines.xml, or
with xmlchange.
Helpful because PROJECT can be used for directory names that don't match
the name of the charge account.
Addresses issue #1588