Skip to content

Commit

Permalink
Merge pull request #3 from muselab-d2x/feature/jobs
Browse files Browse the repository at this point in the history
- Fix bug with reusing a successful scratch create request
  • Loading branch information
jlantz authored Mar 6, 2024
2 parents 63d3c50 + 602217a commit def4bc9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/d2x_cli/commands/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ def pre_flow(self, coordinator):
self.steps = coordinator.steps
self.live.start()
self._init_job_panel()
self.log_task = asyncio.create_task(
self.tail_logs()
) # Start as a background task
#self.log_task = asyncio.create_task(
# self.tail_logs()
#) # Start as a background task
return coordinator

def pre_task(self, step: StepSpec):
Expand Down Expand Up @@ -719,14 +719,17 @@ def run_job(runtime, job_id, retry_scratch=False, verbose=False):

# If the scratch create request is completed, use its org
if scratch_create_request["status"] == "success":
org_user = d2x.read(
D2XApiObjects.OrgUser, scratch_create_request["org_user_id"]
)
import_org_from_d2x(
d2x,
runtime.keychain,
logger,
org_name,
org_id=scratch_create_request["org_id"],
org_salesforce_id=org_user["org"]["salesforce_id"],
org_user_id=scratch_create_request["org_user_id"],
username=scratch_create_request["username"],
username=org_user["username"],
org_alias=scratch_alias,
)

Expand Down
7 changes: 7 additions & 0 deletions src/d2x_cli/commands/scratch.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ def list(runtime, include_delete):
api_list_to_table(d2x.list(D2XApiObjects.ScratchCreateRequest))
if include_delete:
api_list_to_table(d2x.list(D2XApiObjects.ScratchDeleteRequest))

@scratch.command(name="info", help="Get information about a scratch org request.")
@click.argument("id", type=str)
@pass_runtime(require_project=True, require_keychain=True)
def info(runtime, id):
d2x = get_d2x_api_client(runtime)
print(d2x.read(D2XApiObjects.ScratchCreateRequest, id))

0 comments on commit def4bc9

Please sign in to comment.