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

add option CHARGE_ACCOUNT to charge compute time if different from PROJECT #1718

Merged
merged 4 commits into from
Aug 28, 2017

Conversation

sarich
Copy link
Contributor

@sarich sarich commented Aug 15, 2017

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

… 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.
@sarich sarich added BFB PR leaves answers BFB CIME Machine Files labels Aug 15, 2017
@rljacob rljacob requested a review from mrnorman August 15, 2017 17:38
Copy link
Member

@jgfouca jgfouca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline

@@ -59,6 +59,7 @@ OR
parser.add_argument("--project", "-project",
help="Specify a project id")


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plz remove unnecessary newline.

@@ -183,6 +183,7 @@ OR
"Used for accounting when on a batch system."
"The default is user-specified environment variable PROJECT")


Copy link
Member

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
Copy link
Member

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.

@sarich
Copy link
Contributor Author

sarich commented Aug 15, 2017 via email

@jgfouca
Copy link
Member

jgfouca commented Aug 15, 2017

@sarich

Since the function uses a Machine object, the unit test would probably look most like some of the tests in machines.py. Look for <<<

@sarich
Copy link
Contributor Author

sarich commented Aug 16, 2017

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks perfect, thanks.

>>> os.environ["CHARGE_ACCOUNT"] = "ChargeAccount"
>>> get_charge_account(machobj)
'ChargeAccount'
>>> reset_cime_config()
Copy link
Member

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.

@jgfouca
Copy link
Member

jgfouca commented Aug 18, 2017

Approved. Waiting for @mrnorman

@mrnorman
Copy link
Contributor

Sorry, I've been out sick for a couple of weeks. Also Titan's down today. So hopefully I can test this tomorrow.

@mrnorman
Copy link
Contributor

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.

@sarich
Copy link
Contributor Author

sarich commented Aug 24, 2017 via email

@mrnorman
Copy link
Contributor

Well, it ran successfully for me on Titan.

Copy link
Contributor

@mrnorman mrnorman left a 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.

@jgfouca
Copy link
Member

jgfouca commented Aug 24, 2017

OK, merging

@sarich
Copy link
Contributor Author

sarich commented Aug 24, 2017 via email

jgfouca added a commit that referenced this pull request Aug 24, 2017
)

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
@jgfouca
Copy link
Member

jgfouca commented Aug 24, 2017

Merged to next, I'll merge to master if it doesn't break anything.

@worleyph
Copy link
Contributor

@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.)

@sarich
Copy link
Contributor Author

sarich commented Aug 24, 2017 via email

@mrnorman
Copy link
Contributor

@worleyph I ran FC5AV1C-L with csc190acme, specifying CHARGE_ACCOUNT=csc190acme in the environment and -project csc190 in the create_newcase. It successfully ran.

@mrnorman
Copy link
Contributor

/lustre/atlas/proj-shared/csc190/performance_archive/imn/test_charge_project is where the performance data went.

@worleyph
Copy link
Contributor

Thanks. Looks good.

@mrnorman
Copy link
Contributor

When will this be merged to master?

@jgfouca jgfouca merged commit a8d4242 into master Aug 28, 2017
jgfouca added a commit that referenced this pull request Aug 28, 2017
…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
@jgfouca jgfouca deleted the sarich/scripts/feature-charge-account branch August 28, 2017 16:49
@jgfouca
Copy link
Member

jgfouca commented Aug 28, 2017

@mrnorman done.

@mrnorman
Copy link
Contributor

Sweet!

jgfouca added a commit that referenced this pull request Oct 25, 2017
…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
jgfouca added a commit that referenced this pull request Feb 27, 2018
…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
jgfouca added a commit that referenced this pull request Mar 14, 2018
…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
rljacob pushed a commit that referenced this pull request Apr 12, 2021
…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
rljacob pushed a commit that referenced this pull request Apr 12, 2021
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFB PR leaves answers BFB CIME Machine Files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants