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

Added run_jobs_using_params() #36

Merged
merged 28 commits into from
Apr 29, 2024
Merged

Conversation

mitkotak
Copy link
Collaborator

@mitkotak mitkotak commented Jul 14, 2022

Allows us to do something like

cybergis.run_job_using_params([{"input_a" : 50, "input_b" : "foo"}, {"input_a" : 100, "input_b" : "bar"}])

@alexandermichels
Copy link
Member

@mitkotak I have two tasks on this PR:

  1. Can you check that this all still works with the big changes we pushed to the Core and SDK?
  2. Determine if this PR solves this issue: [FeatureRequest-IGUIDE]Allow to programmatically pre-fill values for model-specific parameters #45

Thanks!

@alexandermichels
Copy link
Member

Just tested this functionality out, It's pretty cool!

There are a few changes we need to make though. I think the way this will be used is to test a variety of parameters/settings to ensure that the job works, so reading from one hard-coded file isn't going to work. I think we should probably remove the code that reads from the JSON if the file exists.

Ideally the solution we want is for the user to provide a path to a JSON or a JSON loaded as a dict to a function like "run_job_using_params(...)" that takes in the dictionary of parameters and submits the job. I don't think we need to add it to the UI right now because this is mostly for model developers and the important part is that the functionality exists.

Other notes for when we come back to this functionality/future work (aka you don't need to do this for this PR):

  1. The save parameters button would be better if we could choose the path/filename, but that's okay for now. We will just have user's move the file/rename it themselves.
  2. Once we have a function like "run_job_using_params(...)" we will probably also want "run_jobs_using_params(...)" which takes a list of paths/dicts, submits each job, and when the job finishes, resets the UI and submits the next one.
  3. Eventually, we might want to make a "dev" flag in the "show_ui(..)" function which only shows the "Save Parameters" button and a tab for running many jobs if dev==True.

@mitkotak mitkotak changed the base branch from refactor_file_system to v2 September 1, 2022 00:40
@alexandermichels alexandermichels added this to the v0.2.3 milestone Sep 5, 2022
@alexandermichels alexandermichels added the new feature A new feature or substantial change to an existing feature label Sep 5, 2022
@mitkotak mitkotak changed the title Save Params Button Added run_jobs_using_parameters() Sep 8, 2022
@mitkotak mitkotak changed the title Added run_jobs_using_parameters() Added run_jobs_using_params() Sep 8, 2022
Copy link
Member

@alexandermichels alexandermichels left a comment

Choose a reason for hiding this comment

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

Overall the code is good and seems to work (ran hello world and pysal-access, then restored the job from the UI to check on them). We need to meet with Drew though to figure out how this would be used and if this would be enough. I'm assuming that we will at the very least need to give indicators on the status of the jobs (running/error/completed) or something for this to be useful for end-users.

hpcUsername=None,
hpcPassword=None,
localExecutableFolder={"type": "git",
"gitId": "hello_world"},
Copy link
Member

Choose a reason for hiding this comment

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

It seems this is how the user would pass in the "job"/"model" which will probably not be intuitive to them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup I will handle that in ParamAccumulator (Will maybe change the name to something else since its handling "job"/"mode" preprocessing as well).

param_acc = ParamAccumulator(params)
job = self.create_job(maintainer, hpc, hpcUsername, hpcPassword)
job.set(localExecutableFolder, localDataFolder, localResultFolder, param_acc.params, env, slurm)
job.submit()
Copy link
Member

Choose a reason for hiding this comment

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

This makes sense and works (tested it with a couple of jobs), but we may also need to report the status of jobs. I imagine the way this is going to be used, end-users will want to know that all of their jobs ran and didn't throw errors. Maybe next week we can sit down with Drew and get feedback on that.

@@ -18,6 +18,12 @@
from IPython.display import display, Markdown, Javascript


class ParamAccumulator:
Copy link
Member

@alexandermichels alexandermichels Sep 8, 2022

Choose a reason for hiding this comment

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

Not quite understanding what the role of this helper class is at this point. It seems to be a wrapper around a dictionary that doesn't provide any additional functionality.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah the role for that class is to handle all of the input preprocessing that might be needed. For e.g. json paths ( working on it rn ) or some other input format that we might wanna support.

@alexandermichels alexandermichels modified the milestones: v0.2.3, v0.2.4 Sep 29, 2022
Copy link
Member

@alexandermichels alexandermichels left a comment

Choose a reason for hiding this comment

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

Tested and seems to work. Not sure how this slipped through the cracks, but approving now.

@alexandermichels alexandermichels merged commit 8be4deb into cybergis:v2 Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature A new feature or substantial change to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants